diff options
author | Matthew Ahrens <[email protected]> | 2020-12-24 20:58:17 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-12-28 10:05:44 -0800 |
commit | f014700a3768fcfcf0be61e1b9fc96e847272d98 (patch) | |
tree | 3af80ee4fee0ec4a19ba4d6bba3da362a560b18a /cmd/ztest | |
parent | a0316ad26851d4b07d5048d5b2034137659babf5 (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
Diffstat (limited to 'cmd/ztest')
-rw-r--r-- | cmd/ztest/ztest.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index b59f7dfc8..f66772fa7 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -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, 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) { |