summaryrefslogtreecommitdiffstats
path: root/cmd/zpool
diff options
context:
space:
mode:
authorIsaac Huang <[email protected]>2015-04-25 22:08:29 -0600
committerBrian Behlendorf <[email protected]>2015-04-27 09:18:02 -0700
commitc5656c4cfc28ecf9daf0a8df527b1bf0900c1f80 (patch)
tree8fdd334c2d097a9a2281b12f4f21561e4fadf612 /cmd/zpool
parentec8501ee1274205f277a7287c3de8119d361afaf (diff)
Memory leak in make_root_vdev()
The newroot nvlist should be freed before returning. Signed-off-by: Isaac Huang <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3264
Diffstat (limited to 'cmd/zpool')
-rw-r--r--cmd/zpool/zpool_vdev.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c
index cf6d2bfa5..cae911426 100644
--- a/cmd/zpool/zpool_vdev.c
+++ b/cmd/zpool/zpool_vdev.c
@@ -1699,8 +1699,10 @@ make_root_vdev(zpool_handle_t *zhp, nvlist_t *props, int force, int check_rep,
if ((newroot = construct_spec(props, argc, argv)) == NULL)
return (NULL);
- if (zhp && ((poolconfig = zpool_get_config(zhp, NULL)) == NULL))
+ if (zhp && ((poolconfig = zpool_get_config(zhp, NULL)) == NULL)) {
+ nvlist_free(newroot);
return (NULL);
+ }
/*
* Validate each device to make sure that its not shared with another