mirror of https://gitee.com/openkylin/libvirt.git
tests: avoid NULL deref upon OOM failure
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc failure.
This commit is contained in:
parent
309647c81f
commit
b78fddea39
|
@ -98,7 +98,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||||
len += strlen(*tmp) + 1;
|
len += strlen(*tmp) + 1;
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
actualargv = malloc(sizeof(*actualargv)*len);
|
if ((actualargv = malloc(sizeof(*actualargv)*len)) == NULL)
|
||||||
|
goto fail;
|
||||||
actualargv[0] = '\0';
|
actualargv[0] = '\0';
|
||||||
tmp = qenv;
|
tmp = qenv;
|
||||||
while (*tmp) {
|
while (*tmp) {
|
||||||
|
|
Loading…
Reference in New Issue