]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
util: fix memleak in virFindSCSIHostByPCI
authorZhang Bo <oscar.zhangbo@huawei.com>
Mon, 27 Apr 2015 06:41:41 +0000 (14:41 +0800)
committerJán Tomko <jtomko@redhat.com>
Mon, 27 Apr 2015 08:04:38 +0000 (10:04 +0200)
free buf in cleanup.

Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
src/util/virutil.c

index 79cdb7a5450ec4a4f48af057987379e0113042f7..042651703fa57e03aba2acdb9646581f0b5ba284 100644 (file)
@@ -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;
 }