[PATCH v1 02/12] conf: fix use after free

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

 



Signed-off-by: Ryan Moeller <ryan@xxxxxxxxxxxxx>
---
 src/conf/virnetworkobj.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c
index 299cdba52d..b2affaacd3 100644
--- a/src/conf/virnetworkobj.c
+++ b/src/conf/virnetworkobj.c
@@ -1886,7 +1886,7 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net,
     }
 
     while ((rc = virDirRead(dh, &de, dir)) > 0) {
-        char *file = NULL;
+        g_autofree char *file = NULL;
 
         if (!virStringStripSuffix(de->d_name, ".xml"))
             continue;
@@ -1894,9 +1894,6 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net,
         file = g_strdup_printf("%s/%s.xml", dir, de->d_name);
 
         portdef = virNetworkPortDefParseFile(file);
-        VIR_FREE(file);
-        file = NULL;
-
         if (!portdef) {
             VIR_WARN("Cannot parse port %s", file);
             continue;
-- 
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