diff options
author | cao <[email protected]> | 2016-09-24 06:43:46 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-09-23 15:43:46 -0700 |
commit | 92bc9278689fcce48183182f2488ead42a9eb790 (patch) | |
tree | faa078a269cff55585a2d14cbd27762c43b558b2 /cmd/zpool/zpool_main.c | |
parent | 7571033285e2f83bf163e0cec31fd2b352beed30 (diff) |
Fix coverity defects: CID 147602 147604
coverity scan CID:147604, Type: Resource leak.
coverity scan CID:147602, Type: Resource leak.
reason: safe_malloc calcvs, goto children but not free calcvs.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: cao.xuewen <[email protected]>
Closes #5155
Diffstat (limited to 'cmd/zpool/zpool_main.c')
-rw-r--r-- | cmd/zpool/zpool_main.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 24902cf34..32615d77f 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -3382,10 +3382,12 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, if (!(cb->cb_flags & IOS_ANYHISTO_M)) printf("\n"); - free(calcvs); ret++; children: + + free(calcvs); + if (!cb->cb_verbose) return (ret); @@ -3734,14 +3736,16 @@ static int is_vdev_cb(zpool_handle_t *zhp, nvlist_t *nv, void *cb_data) { iostat_cbdata_t *cb = cb_data; - char *name; + char *name = NULL; + int ret = 0; name = zpool_vdev_name(g_zfs, zhp, nv, cb->cb_name_flags); if (strcmp(name, cb->cb_vdev_names[0]) == 0) - return (1); /* match */ + ret = 1; /* match */ + free(name); - return (0); + return (ret); } /* |