Fix more leaks detected by ASAN

This commit fixes a bunch of missing free() calls in a10d50f99

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: João Carlos Mendes Luís <jonny@jonny.eng.br>
Closes #10219
This commit is contained in:
Joao Carlos Mendes Luis 2020-04-22 14:40:34 -03:00 committed by GitHub
parent 32d805c3e2
commit 70e5ad31f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -931,10 +931,15 @@ libzfs_mnttab_add(libzfs_handle_t *hdl, const char *special,
* Another thread may have already added this entry * Another thread may have already added this entry
* via libzfs_mnttab_update. If so we should skip it. * 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); free(mtn);
else } else {
avl_add(&hdl->libzfs_mnttab_cache, mtn); avl_add(&hdl->libzfs_mnttab_cache, mtn);
}
} }
pthread_mutex_unlock(&hdl->libzfs_mnttab_cache_lock); pthread_mutex_unlock(&hdl->libzfs_mnttab_cache_lock);
} }