]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: do not leak uri in disconnect handler
authorJán Tomko <jtomko@redhat.com>
Thu, 3 Mar 2016 16:31:47 +0000 (17:31 +0100)
committerJán Tomko <jtomko@redhat.com>
Fri, 4 Mar 2016 07:08:16 +0000 (08:08 +0100)
Commit 035947e introduced a call to virConnectGetURI
without a matching free() in virshCatchDisconnect.

Also fix vshAdmCatchDisconnect where it was copied by
commit 6dd7e42.

https://bugzilla.redhat.com/show_bug.cgi?id=1303891

tools/virsh.c
tools/virt-admin.c

index 72446be37e7d067f37dd4fe5666f4fd3637644a8..57b4ff34751e471def7be2d8b8f9f8861f0d3cb8 100644 (file)
@@ -124,6 +124,7 @@ virshCatchDisconnect(virConnectPtr conn,
             break;
         }
         vshError(ctl, _(str), NULLSTR(uri));
+        VIR_FREE(uri);
 
         if (error) {
             virSetError(error);
index 3c818a3a29d0234fe873afc0f82a6ef5afb75ac3..c47053639dd0989b6159bd7cc3a8f2fbf4890d61 100644 (file)
@@ -92,6 +92,7 @@ vshAdmCatchDisconnect(virAdmConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     vshError(ctl, _(str), NULLSTR(uri));
+    VIR_FREE(uri);
 
     if (error) {
         virSetError(error);