aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Ahrens <[email protected]>2020-12-24 20:58:17 -0800
committerBrian Behlendorf <[email protected]>2021-01-05 10:31:58 -0800
commit88d7da62b525e21f77319fce98ab7ce35ab266c0 (patch)
treec81bf3b86727dc21a30fb868ab01a941121c201e
parent6410ee4a94858669f735a1a6562f36f0d82505ec (diff)
Memory leak in ztest_dmu_objset_own()
Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matthew Ahrens <[email protected]> Closes #11396
-rw-r--r--cmd/ztest/ztest.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 3b69e9f2b..5d946294b 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -1332,7 +1332,11 @@ ztest_dmu_objset_own(const char *name, dmu_objset_type_t type,
VERIFY0(dsl_crypto_params_create_nvlist(DCP_CMD_NONE, NULL,
crypto_args, &dcp));
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);
if (err == EINVAL) {