[PATCH 3/3] qemu: Fix resource leak in qemuDomainAddChardevTLSObjects error path

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

 



On any failure, call virJSONValueFree for the *Props.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 87d7dcd..852d85b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -213,7 +213,7 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver,
                                 cfg->migrateTLSx509verify,
                                 QEMU_MIGRATION_TLS_ALIAS_BASE,
                                 &tlsProps, tlsAlias, &secProps, secAlias) < 0)
-        return -1;
+        goto error;
 
     /* Ensure the domain doesn't already have the TLS objects defined...
      * This should prevent any issues just in case some cleanup wasn't
@@ -223,12 +223,17 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver,
 
     if (qemuDomainAddTLSObjects(driver, vm, asyncJob, *secAlias, &secProps,
                                 *tlsAlias, &tlsProps) < 0)
-        return -1;
+        goto error;
 
     if (VIR_STRDUP(migParams->migrateTLSAlias, *tlsAlias) < 0)
-        return -1;
+        goto error;
 
     return 0;
+
+ error:
+    virJSONValueFree(tlsProps);
+    virJSONValueFree(secProps);
+    return -1;
 }
 
 
-- 
2.9.3

--
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