Skip to content

Commit

Permalink
Memory leak in make_root_vdev()
Browse files Browse the repository at this point in the history
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
  • Loading branch information
huangheintel authored and behlendorf committed Apr 27, 2015
1 parent ec8501e commit c5656c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5656c4

Please sign in to comment.