From c5656c4cfc28ecf9daf0a8df527b1bf0900c1f80 Mon Sep 17 00:00:00 2001 From: Isaac Huang Date: Sat, 25 Apr 2015 22:08:29 -0600 Subject: [PATCH] Memory leak in make_root_vdev() The newroot nvlist should be freed before returning. Signed-off-by: Isaac Huang Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Closes #3264 --- cmd/zpool/zpool_vdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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