aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFinix1979 <yanchongwen@hotmail.com>2022-07-07 18:43:58 +0000
committerGitHub <noreply@github.com>2022-07-07 18:43:58 +0000
commitcb01da68057dcb9e612e8d2e97d058c46c3574af (patch)
treeb278f6b08814cd3556839717ce6ef2b1706cd7c0
parent74230a5bc1be6e5e84a5f41b26f6f65a155078f0 (diff)
downloadsrc-cb01da68057dcb9e612e8d2e97d058c46c3574af.tar.gz
src-cb01da68057dcb9e612e8d2e97d058c46c3574af.zip
Call nvlist_free before return
Fixes a small kernel memory leak which would occur if a pool failed to import because the `DMU_POOL_VDEV_ZAP_MAP` key can't be read from a presumably damaged MOS config. In the case of a missing key there was no leak. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Finix1979 <yancw@info2soft.com> Closes #13629
-rw-r--r--module/zfs/spa.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 55f3a4de603f..85a3a3c0c127 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -4209,6 +4209,7 @@ spa_ld_get_props(spa_t *spa)
spa->spa_avz_action = AVZ_ACTION_INITIALIZE;
ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev));
} else if (error != 0) {
+ nvlist_free(mos_config);
return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
} else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) {
/*