mirror of https://github.com/xemu-project/xemu.git
qemu-io-cmds: g_renew() can't fail, bury dead error handling
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
02c4f26b15
commit
08193dd52b
|
@ -115,22 +115,13 @@ static char **breakline(char *input, int *count)
|
||||||
int c = 0;
|
int c = 0;
|
||||||
char *p;
|
char *p;
|
||||||
char **rval = g_new0(char *, 1);
|
char **rval = g_new0(char *, 1);
|
||||||
char **tmp;
|
|
||||||
|
|
||||||
while (rval && (p = qemu_strsep(&input, " ")) != NULL) {
|
while (rval && (p = qemu_strsep(&input, " ")) != NULL) {
|
||||||
if (!*p) {
|
if (!*p) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
c++;
|
c++;
|
||||||
tmp = g_renew(char *, rval, (c + 1));
|
rval = g_renew(char *, rval, (c + 1));
|
||||||
if (!tmp) {
|
|
||||||
g_free(rval);
|
|
||||||
rval = NULL;
|
|
||||||
c = 0;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
rval = tmp;
|
|
||||||
}
|
|
||||||
rval[c - 1] = p;
|
rval[c - 1] = p;
|
||||||
rval[c] = NULL;
|
rval[c] = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue