]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Fix build with -Werror
authorJiri Denemark <jdenemar@redhat.com>
Mon, 6 Feb 2012 08:35:47 +0000 (09:35 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 6 Feb 2012 08:35:47 +0000 (09:35 +0100)
tests/cputest.c

index 15614a785f174b10ac4ae2ff360939e3dc9a86f1..870f99f6f2949a6822d3cd12794d03efee5bbe48 100644 (file)
@@ -126,17 +126,17 @@ cpuTestLoadMultiXML(const char *arch,
         goto cleanup;
 
     if (!(doc = virXMLParseFileCtxt(xml, &ctxt)))
-        goto error;
+        goto cleanup;
 
     n = virXPathNodeSet("/cpuTest/cpu", ctxt, &nodes);
     if (n <= 0 || (VIR_ALLOC_N(cpus, n) < 0))
-        goto error;
+        goto cleanup;
 
     for (i = 0; i < n; i++) {
         ctxt->node = nodes[i];
         cpus[i] = virCPUDefParseXML(nodes[i], ctxt, VIR_CPU_TYPE_HOST);
         if (!cpus[i])
-            goto error;
+            goto cleanup_cpus;
     }
 
     *count = n;
@@ -148,13 +148,10 @@ cleanup:
     xmlFreeDoc(doc);
     return cpus;
 
-error:
-    if (cpus) {
-        for (i = 0; i < n; i++)
-            virCPUDefFree(cpus[i]);
-        VIR_FREE(cpus);
-        cpus = NULL;
-    }
+cleanup_cpus:
+    for (i = 0; i < n; i++)
+        virCPUDefFree(cpus[i]);
+    VIR_FREE(cpus);
     goto cleanup;
 }