[PATCH 2/5] virLXCProcessSetupNamespaceName: Fix potential uninitialized free of 'path'

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

 



'path' could be accessed uninitialized. Fix it by using g_autofree which
also mandates initialization.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/lxc/lxc_process.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 0277ba8b62..cd0026f78f 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -409,7 +409,7 @@ static int virLXCProcessSetupNamespaceName(virLXCDriverPtr driver,
     int fd = -1;
     virDomainObjPtr vm;
     virLXCDomainObjPrivatePtr priv;
-    char *path;
+    g_autofree char *path = NULL;

     vm = virDomainObjListFindByName(driver->domains, name);
     if (!vm) {
@@ -436,7 +436,6 @@ static int virLXCProcessSetupNamespaceName(virLXCDriverPtr driver,
     }

  cleanup:
-    VIR_FREE(path);
     virDomainObjEndAPI(&vm);
     return fd;
 }
-- 
2.24.1





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

  Powered by Linux