]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: Need to initialize 'test' properly on error path
authorJohn Ferlan <jferlan@redhat.com>
Tue, 22 Jan 2013 14:15:50 +0000 (09:15 -0500)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 22 Jan 2013 16:29:26 +0000 (17:29 +0100)
In the error path, the test buffer is free'd, but due to how the free
routine is written the 'test' buffer pointer does not return to the caller
as NULL and then the free'd buffer address is returned to the caller.

tests/qemumonitortestutils.c

index eb9174df5f05adb04f34bff2b9be45b6443ce3f4..d1b2ab5b05905104aa8f5077e312b35f87bb3471 100644 (file)
@@ -536,6 +536,7 @@ no_memory:
 error:
     VIR_FREE(tmpdir_template);
     qemuMonitorTestFree(test);
+    test = NULL;
     goto cleanup;
 }