[PATCH] virCapabilitiesInitCaches: Don't leak cache dir

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

 



To every virDirOpen we must have VIR_DIR_CLOSE otherwise FD is
leaked.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/capabilities.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index d699b0817..a91a72a35 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1555,6 +1555,8 @@ virCapabilitiesInitCaches(virCapsPtr caps)
         if (virAsprintf(&path, "%s/cpu/cpu%zd/cache/", SYSFS_SYSTEM_PATH, pos) < 0)
             goto cleanup;
 
+        VIR_DIR_CLOSE(dirp);
+
         rv = virDirOpenIfExists(&dirp, path);
         if (rv < 0)
             goto cleanup;
@@ -1639,7 +1641,7 @@ virCapabilitiesInitCaches(virCapsPtr caps)
  cleanup:
     VIR_FREE(type);
     VIR_FREE(path);
-    virDirClose(&dirp);
+    VIR_DIR_CLOSE(dirp);
     virCapsHostCacheBankFree(bank);
     return ret;
 }
-- 
2.13.0

--
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]
  Powered by Linux