From 9aa175f2492bd1169587a06ff02f5e5e36952126 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Tue, 12 Jul 2016 11:54:25 +0000 Subject: [PATCH] 6873 zfs_destroy_snaps_nvl leaks errlist illumos/illumos-gate@4cde22c29999ffb907ca39d2ebd512812f7e5168 https://github.com/illumos/illumos-gate/commit/4cde22c29999ffb907ca39d2ebd512812f7e5168 https://www.illumos.org/issues/6873 lzc_destroy_snaps() returns an nvlist in errlist. zfs_destroy_snaps_nvl() should nvlist_free() it before returning. Reviewed by: Matthew Ahrens Reviewed by: Paul Dagnelie Approved by: Dan McDonald Author: Chris Williamson --- lib/libzfs/common/libzfs_dataset.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/common/libzfs_dataset.c b/lib/libzfs/common/libzfs_dataset.c index c0db45b45598..2ab51b113ead 100644 --- a/lib/libzfs/common/libzfs_dataset.c +++ b/lib/libzfs/common/libzfs_dataset.c @@ -3405,12 +3405,14 @@ int zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer) { int ret; - nvlist_t *errlist; + nvlist_t *errlist = NULL; 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]; @@ -3438,6 +3440,7 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer) } } + nvlist_free(errlist); return (ret); }