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;
|
||||
tmp++;
|
||||
}
|
||||
actualargv = malloc(sizeof(*actualargv)*len);
|
||||
if ((actualargv = malloc(sizeof(*actualargv)*len)) == NULL)
|
||||
goto fail;
|
||||
actualargv[0] = '\0';
|
||||
tmp = qenv;
|
||||
while (*tmp) {
|
||||
|
|
Loading…
Reference in New Issue