From 70e5ad31f6425868b8a173bbc2be4ef08a8d949b Mon Sep 17 00:00:00 2001 From: Joao Carlos Mendes Luis Date: Wed, 22 Apr 2020 14:40:34 -0300 Subject: [PATCH] Fix more leaks detected by ASAN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a bunch of missing free() calls in a10d50f99 Reviewed-by: Brian Behlendorf Signed-off-by: João Carlos Mendes Luís Closes #10219 --- lib/libzfs/libzfs_dataset.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 45e7a79fb491..90c6b68e387c 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -931,10 +931,15 @@ libzfs_mnttab_add(libzfs_handle_t *hdl, const char *special, * Another thread may have already added this entry * via libzfs_mnttab_update. If so we should skip it. */ - if (avl_find(&hdl->libzfs_mnttab_cache, mtn, NULL) != NULL) + if (avl_find(&hdl->libzfs_mnttab_cache, mtn, NULL) != NULL) { + free(mtn->mtn_mt.mnt_special); + free(mtn->mtn_mt.mnt_mountp); + free(mtn->mtn_mt.mnt_fstype); + free(mtn->mtn_mt.mnt_mntopts); free(mtn); - else + } else { avl_add(&hdl->libzfs_mnttab_cache, mtn); + } } pthread_mutex_unlock(&hdl->libzfs_mnttab_cache_lock); }