memory: Fix memory leak of g_vtophys_map allocated failed.

if g_phys_ref_map allocated successfully and g_vtophys_map
allocated failed. It reports memory leaks. so add
spdk_mem_map_free(&g_phys_ref_map).

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I06149c98f158d1c679e5045e279beccbdea10e55
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7249
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Chengqiang Meng <chengqiangx.meng@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
yidong0635 2021-04-06 01:55:24 +08:00 committed by Tomasz Zawadzki
parent f40b0b1629
commit 35dfd3eafb

View File

@ -1411,6 +1411,7 @@ vtophys_init(void)
g_vtophys_map = spdk_mem_map_alloc(SPDK_VTOPHYS_ERROR, &vtophys_map_ops, NULL);
if (g_vtophys_map == NULL) {
DEBUG_PRINT("vtophys map allocation failed\n");
spdk_mem_map_free(&g_phys_ref_map);
return -ENOMEM;
}
return 0;