From: Michal Privoznik <[email protected]>

During hotplug of an <interface/> into an LXC domain
(lxcDomainAttachDeviceNetLive()), the host side name of the
interface is stored in @veth variable. Well, all possible paths
that set the variable (virLXCProcessSetupInterfaceTap(),
virLXCProcessSetupInterfaceDirect()) document it is caller's
responsibility to free the memory. But it never does so.

==49848== 12 bytes in 2 blocks are definitely lost in loss record 68 of 1,763
==49848==    at 0x4913888: malloc (vg_replace_malloc.c:447)
==49848==    by 0x546F0BC: __vasprintf_internal (in /usr/lib64/libc.so.6)
==49848==    by 0x5077A70: g_vasprintf (in /usr/lib64/libglib-2.0.so.0.8400.4)
==49848==    by 0x50404DB: g_strdup_vprintf (in 
/usr/lib64/libglib-2.0.so.0.8400.4)
==49848==    by 0x50405A4: g_strdup_printf (in 
/usr/lib64/libglib-2.0.so.0.8400.4)
==49848==    by 0x4A8591E: virNetDevGenerateName (virnetdev.c:3573)
==49848==    by 0x4A93C38: virNetDevVethCreate (virnetdevveth.c:124)
==49848==    by 0xED6C505: virLXCProcessSetupInterfaceTap (lxc_process.c:279)
==49848==    by 0xED5F7A7: lxcDomainAttachDeviceNetLive (lxc_driver.c:3517)
==49848==    by 0xED60D24: lxcDomainAttachDeviceLive (lxc_driver.c:3925)
==49848==    by 0xED6262D: lxcDomainAttachDeviceFlags (lxc_driver.c:4453)
==49848==    by 0xED62819: lxcDomainAttachDevice (lxc_driver.c:4485)

Signed-off-by: Michal Privoznik <[email protected]>
---
 src/lxc/lxc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 0b0592a4b7..a1a0343a5b 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3473,7 +3473,7 @@ lxcDomainAttachDeviceNetLive(virLXCDriver *driver,
     int ret = -1;
     virDomainNetType actualType;
     const virNetDevBandwidth *actualBandwidth;
-    char *veth = NULL;
+    g_autofree char *veth = NULL;
 
     if (!priv->initpid) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-- 
2.53.0

Reply via email to