Re: [PATCH] lxc; Fir memory leak if virSocketAddrGetIPPrefix fails

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

 



On 07/01/2016 09:06 AM, Jiri Denemark wrote:
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);

Oops. The dangers of rebasing and making small changes time after time.

ACK to this, although I'll be pushing the previously reverted (due to my mistakenly pushing them after the freeze) patches today, which will eliminate this code completely (and replace it with a call to another function that doesn't have the leak :-)

                  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;


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