]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
tests: avoid NULL deref upon OOM failure
authorJim Meyering <meyering@redhat.com>
Tue, 16 Feb 2010 08:36:57 +0000 (09:36 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 16 Feb 2010 17:09:13 +0000 (18:09 +0100)
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Handle malloc
failure.

tests/qemuxml2argvtest.c

index 3ee71a3b1b2239ed08c7a635dcb5330c0daf2769..aa42f996eb59649fefd1e0c2588f2482aa318f82 100644 (file)
@@ -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) {