Skip to content

Commit

Permalink
Call nvlist_free before return
Browse files Browse the repository at this point in the history
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 openzfs#13629
  • Loading branch information
Finix1979 authored and snajpa committed Oct 22, 2022
1 parent f927c2f commit 85873e1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions module/zfs/spa.c
Original file line number Diff line number Diff line change
Expand Up @@ -4164,6 +4164,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)) {
/*
Expand Down

0 comments on commit 85873e1

Please sign in to comment.