dmu_redact_snap: fix possible memleak

Reviewed-by: Ryan Moeller <freqlabs@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
Closes #10879
This commit is contained in:
Pavel Snajdr 2020-09-07 17:27:51 +02:00 committed by Brian Behlendorf
parent df39626fdd
commit c9eab8257d

View File

@ -1078,6 +1078,8 @@ dmu_redact_snap(const char *snapname, nvlist_t *redactnvl,
dsl_pool_rele(dp, FTAG); dsl_pool_rele(dp, FTAG);
kmem_free(newredactbook, kmem_free(newredactbook,
sizeof (char) * ZFS_MAX_DATASET_NAME_LEN); sizeof (char) * ZFS_MAX_DATASET_NAME_LEN);
if (args != NULL)
kmem_free(args, numsnaps * sizeof (*args));
return (SET_ERROR(ENAMETOOLONG)); return (SET_ERROR(ENAMETOOLONG));
} }
err = dsl_bookmark_lookup(dp, newredactbook, NULL, &bookmark); err = dsl_bookmark_lookup(dp, newredactbook, NULL, &bookmark);