bdev: free g_bdev_examine_allowlist before the app exit

Add a bdev_examine_allowlist_free function, which releases the members
in g_bdev_examine_allowlist. Invoke it in bdev_mgr_unregister_cb.

Signed-off-by: Peng Yu <yupeng0921@gmail.com>
Change-Id: I47faf6959066da6679716b2f2abfab8ac8b8dd79
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3880
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
yupeng 2020-08-21 06:51:10 +00:00 committed by Tomasz Zawadzki
parent af4fa14891
commit 2b16cfff9e

View File

@ -425,6 +425,18 @@ bdev_examine_allowlist_check(const char *name)
return false;
}
static inline void
bdev_examine_allowlist_free(void)
{
struct spdk_bdev_examine_item *item;
while (!TAILQ_EMPTY(&g_bdev_examine_allowlist)) {
item = TAILQ_FIRST(&g_bdev_examine_allowlist);
TAILQ_REMOVE(&g_bdev_examine_allowlist, item, link);
free(item->name);
free(item);
}
}
static inline bool
bdev_in_examine_allowlist(struct spdk_bdev *bdev)
{
@ -1379,6 +1391,8 @@ bdev_mgr_unregister_cb(void *io_device)
spdk_free(g_bdev_mgr.zero_buffer);
bdev_examine_allowlist_free();
cb_fn(g_fini_cb_arg);
g_fini_cb_fn = NULL;
g_fini_cb_arg = NULL;