[PATCH 04/23] vmware: Fix some initialization problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/vmware/vmware_conf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 0c2b0f4c0be3..3ced61028e97 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -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
-- 
2.12.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux