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