render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
3e5111
From f032a2a22052128bd0b3d41d2b5574ce27259eef Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <f032a2a22052128bd0b3d41d2b5574ce27259eef@dist-git>
3e5111
From: John Ferlan <jferlan@redhat.com>
3e5111
Date: Mon, 3 Apr 2017 12:53:33 -0400
3e5111
Subject: [PATCH] qemu: Fix resource leak in qemuDomainAddChardevTLSObjects
3e5111
 error path
3e5111
3e5111
On any failure, call virJSONValueFree for the *Props.
3e5111
3e5111
Signed-off-by: John Ferlan <jferlan@redhat.com>
3e5111
(cherry picked from commit 2e8c60958ac32624296eee263bf34bb21a32360c)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1300769
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/qemu/qemu_migration.c | 11 ++++++++---
3e5111
 1 file changed, 8 insertions(+), 3 deletions(-)
3e5111
3e5111
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
3e5111
index dabfe10c0..fcd3a38a1 100644
3e5111
--- a/src/qemu/qemu_migration.c
3e5111
+++ b/src/qemu/qemu_migration.c
3e5111
@@ -213,7 +213,7 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver,
3e5111
                                 cfg->migrateTLSx509verify,
3e5111
                                 QEMU_MIGRATION_TLS_ALIAS_BASE,
3e5111
                                 &tlsProps, tlsAlias, &secProps, secAlias) < 0)
3e5111
-        return -1;
3e5111
+        goto error;
3e5111
 
3e5111
     /* Ensure the domain doesn't already have the TLS objects defined...
3e5111
      * This should prevent any issues just in case some cleanup wasn't
3e5111
@@ -223,12 +223,17 @@ qemuMigrationAddTLSObjects(virQEMUDriverPtr driver,
3e5111
 
3e5111
     if (qemuDomainAddTLSObjects(driver, vm, asyncJob, *secAlias, &secProps,
3e5111
                                 *tlsAlias, &tlsProps) < 0)
3e5111
-        return -1;
3e5111
+        goto error;
3e5111
 
3e5111
     if (VIR_STRDUP(migParams->migrateTLSAlias, *tlsAlias) < 0)
3e5111
-        return -1;
3e5111
+        goto error;
3e5111
 
3e5111
     return 0;
3e5111
+
3e5111
+ error:
3e5111
+    virJSONValueFree(tlsProps);
3e5111
+    virJSONValueFree(secProps);
3e5111
+    return -1;
3e5111
 }
3e5111
 
3e5111
 
3e5111
-- 
3e5111
2.12.2
3e5111