Memory leak in ztest_dmu_objset_own()

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #11396
This commit is contained in:
Matthew Ahrens 2020-12-24 20:58:17 -08:00 committed by Brian Behlendorf
parent a0316ad268
commit f014700a37
1 changed files with 5 additions and 1 deletions

View File

@ -1441,7 +1441,11 @@ ztest_dmu_objset_own(const char *name, dmu_objset_type_t type,
VERIFY0(dsl_crypto_params_create_nvlist(DCP_CMD_NONE, NULL, VERIFY0(dsl_crypto_params_create_nvlist(DCP_CMD_NONE, NULL,
crypto_args, &dcp)); crypto_args, &dcp));
err = spa_keystore_load_wkey(ddname, dcp, B_FALSE); err = spa_keystore_load_wkey(ddname, dcp, B_FALSE);
dsl_crypto_params_free(dcp, B_FALSE); /*
* Note: if there was an error loading, the wkey was not
* consumed, and needs to be freed.
*/
dsl_crypto_params_free(dcp, (err != 0));
fnvlist_free(crypto_args); fnvlist_free(crypto_args);
if (err == EINVAL) { if (err == EINVAL) {