]> xenbits.xensource.com Git - libvirt.git/commitdiff
vmx: avoid memory leak
authorajia@redhat.com <ajia@redhat.com>
Mon, 19 Sep 2011 02:34:06 +0000 (10:34 +0800)
committerEric Blake <eblake@redhat.com>
Mon, 19 Sep 2011 19:43:36 +0000 (13:43 -0600)
* src/vmx/vmx.c: fix memory leak, 'def' has a initial value 'NULL', so
  'goto cleanup' is perfected instead of adding a virConfFree before
  'return NULL'.

Signed-off-by: Alex Jia <ajia@redhat.com>
src/vmx/vmx.c

index dff3599403b664b4a39c24d2d5eac8e2c6137429..be91c13ef78e73e53d394f89077505520512b5d8 100644 (file)
@@ -1253,7 +1253,7 @@ virVMXParseConfig(virVMXContext *ctx, virCapsPtr caps, const char *vmx)
     /* Allocate domain def */
     if (VIR_ALLOC(def) < 0) {
         virReportOOMError();
-        return NULL;
+        goto cleanup;
     }
 
     def->virtType = VIR_DOMAIN_VIRT_VMWARE;