Memory leak in make_root_vdev()

The newroot nvlist should be freed before returning.

Signed-off-by: Isaac Huang <he.huang@intel.com>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3264
This commit is contained in:
Isaac Huang 2015-04-25 22:08:29 -06:00 committed by Brian Behlendorf
parent ec8501ee12
commit c5656c4cfc

View File

@ -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) if ((newroot = construct_spec(props, argc, argv)) == NULL)
return (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); return (NULL);
}
/* /*
* Validate each device to make sure that its not shared with another * Validate each device to make sure that its not shared with another