From b3744ae611a1920aa37b44aa3b37f02c7f23a5ba Mon Sep 17 00:00:00 2001 From: Chris Williamson Date: Tue, 19 Apr 2016 20:45:04 -0700 Subject: [PATCH] OpenZFS 6873 - zfs_destroy_snaps_nvl leaks errlist Authored by: Chris Williamson Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Ported-by: Denys Rtveliashvili Signed-off-by: Brian Behlendorf 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: https://github.com/openzfs/openzfs/commit/ee06391 Closes #4614 --- lib/libzfs/libzfs_dataset.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 1d9e5156a..3586c0e5e 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -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]; @@ -3481,6 +3483,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer) } } + nvlist_free(errlist); return (ret); } -- 2.40.0