[PATCH 2/6] util: fix memleak in virFindSCSIHostByPCI

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

 



free buf in cleanup.

Signed-off-by: Zhang Bo <oscar.zhangbo@xxxxxxxxxx>
---
 src/util/virutil.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virutil.c b/src/util/virutil.c
index 79cdb7a..0426517 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1815,6 +1815,8 @@ virFindSCSIHostByPCI(const char *sysfs_prefix,
         if (virStrToLong_ui(buf, NULL, 10, &read_unique_id) < 0)
             goto cleanup;
 
+        VIR_FREE(buf);
+
         if (read_unique_id != unique_id) {
             VIR_FREE(unique_path);
             continue;
@@ -1829,6 +1831,7 @@ virFindSCSIHostByPCI(const char *sysfs_prefix,
     VIR_FREE(unique_path);
     VIR_FREE(host_link);
     VIR_FREE(host_path);
+    VIR_FREE(buf);
     return ret;
 }
 
-- 
1.7.12.4


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