[PATCH 07/28] lxc: eliminate extraneous free of netDef->ifname_guest

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

 



lxcContainerRenameAndEnableInterfaces() isn't making a copy of the
interface's ifname_guest (into newname), it's just copying the pointer
to it. This means that when it later calls VIR_FREE(newname), it's
actually freeing up (and fortunately NULLing out, so at least we don't
try to access free'd memory) netDef->ifname_guest.
---
 src/lxc/lxc_container.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 531bbd5..3d9e28b 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -490,7 +490,7 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
 {
     int rc = 0;
     size_t i, j;
-    char *newname = NULL;
+    const char *newname;
     char *toStr = NULL;
     char *viaStr = NULL;
     virDomainNetDefPtr netDef;
@@ -552,8 +552,6 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
                 VIR_FREE(viaStr);
             }
         }
-
-        VIR_FREE(newname);
     }
 
     /* enable lo device only if there were other net devices */
@@ -563,7 +561,6 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
  error_out:
     VIR_FREE(toStr);
     VIR_FREE(viaStr);
-    VIR_FREE(newname);
     return rc;
 }
 
-- 
2.5.5

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