]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix resource leak in qemuDomainAddChardevTLSObjects error path
authorJohn Ferlan <jferlan@redhat.com>
Mon, 3 Apr 2017 16:53:33 +0000 (12:53 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 4 Apr 2017 16:40:27 +0000 (12:40 -0400)
On any failure, call virJSONValueFree for the *Props.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_migration.c

index 87d7dcd0c526fe1da7af51ad81a9f733b4e192a5..852d85b55011c845ef15133a31789f63071e93f6 100644 (file)
@@ -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;
 }