]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vmware: Fix some initialization problems
authorMartin Kletzander <mkletzan@redhat.com>
Wed, 15 Mar 2017 08:10:12 +0000 (09:10 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 27 Mar 2017 11:13:29 +0000 (13:13 +0200)
Don't leak guest if adding it to virCapabilities fails.  Also return
NULL and not pointer to free'd object with zero references in such
case.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/vmware/vmware_conf.c

index 0c2b0f4c0be3c654fbcc5947f33da019ef5218d9..3ced61028e97f9b468a4232bc9eae980812f7ff6 100644 (file)
@@ -105,14 +105,15 @@ vmwareCapsInit(void)
                                           VIR_DOMAIN_VIRT_VMWARE,
                                           NULL, NULL, 0, NULL) == NULL)
             goto error;
+        guest = NULL;
     }
 
- cleanup:
     return caps;
 
  error:
+    virCapabilitiesFreeGuest(guest);
     virObjectUnref(caps);
-    goto cleanup;
+    return NULL;
 }
 
 int