Skip to content

Commit

Permalink
OpenZFS 6873 - zfs_destroy_snaps_nvl leaks errlist
Browse files Browse the repository at this point in the history
Authored by: Chris Williamson <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Paul Dagnelie <[email protected]>
Ported-by: Denys Rtveliashvili <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>

lzc_destroy_snaps() returns an nvlist in errlist.
zfs_destroy_snaps_nvl() should nvlist_free() it before returning.

OpenZFS-issue: https://www.illumos.org/issues/6873
OpenZFS-commit: openzfs/openzfs@ee06391
Closes #4614
  • Loading branch information
cwill authored and behlendorf committed May 9, 2016
1 parent 9f8026c commit b3744ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/libzfs/libzfs_dataset.c
Original file line number Diff line number Diff line change
Expand Up @@ -3447,13 +3447,15 @@ int
zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
{
int ret;
nvlist_t *errlist;
nvlist_t *errlist = NULL;
nvpair_t *pair;

ret = lzc_destroy_snaps(snaps, defer, &errlist);

if (ret == 0)
if (ret == 0) {
nvlist_free(errlist);
return (0);
}

if (nvlist_empty(errlist)) {
char errbuf[1024];
Expand Down Expand Up @@ -3481,6 +3483,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
}
}

nvlist_free(errlist);
return (ret);
}

Expand Down

0 comments on commit b3744ae

Please sign in to comment.