[PATCH] lxc; Fir memory leak if virSocketAddrGetIPPrefix fails

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/lxc/lxc_container.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 0d5f16c..65930c9 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -514,18 +514,16 @@ lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
         for (j = 0; j < netDef->guestIP.nips; j++) {
             virNetDevIPAddrPtr ip = netDef->guestIP.ips[j];
             int prefix;
-            char *ipStr = virSocketAddrFormat(&ip->address);
 
             if ((prefix = virSocketAddrGetIPPrefix(&ip->address,
                                                    NULL, ip->prefix)) < 0) {
-                ipStr = virSocketAddrFormat(&ip->address);
+                char *ipStr = virSocketAddrFormat(&ip->address);
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("Failed to determine prefix for IP address '%s'"),
                                ipStr);
                 VIR_FREE(ipStr);
                 goto cleanup;
             }
-            VIR_FREE(ipStr);
 
             if (virNetDevIPAddrAdd(newname, &ip->address, NULL, prefix) < 0)
                 goto cleanup;
-- 
2.9.0

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