tests: avoid NULL deref upon OOM failure

* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc
failure.
This commit is contained in:
Jim Meyering 2010-02-16 09:36:57 +01:00
parent 309647c81f
commit b78fddea39
1 changed files with 2 additions and 1 deletions

View File

@ -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) {