summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoao Carlos Mendes Luis <[email protected]>2020-04-22 14:40:34 -0300
committerGitHub <[email protected]>2020-04-22 10:40:34 -0700
commit70e5ad31f6425868b8a173bbc2be4ef08a8d949b (patch)
tree037b8149376465c48e7509927af047b5f3bf6605 /lib
parent32d805c3e2888cbb71956454ced38b4882c27c00 (diff)
Fix more leaks detected by ASAN
This commit fixes a bunch of missing free() calls in a10d50f99 Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: João Carlos Mendes Luís <[email protected]> Closes #10219
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_dataset.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c
index 45e7a79fb..90c6b68e3 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);
}