From: Zhang Bo Date: Mon, 27 Apr 2015 06:41:41 +0000 (+0800) Subject: util: fix memleak in virFindSCSIHostByPCI X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6fabe2f2273f5a23298ea6dd29f14965b983b5d7;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git util: fix memleak in virFindSCSIHostByPCI free buf in cleanup. Signed-off-by: Zhang Bo --- diff --git a/src/util/virutil.c b/src/util/virutil.c index 79cdb7a54..042651703 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; }