mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-04 10:55:19 +00:00
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…
x
Reference in New Issue
Block a user