sock: Add the code to free the entry

Checked code, we do not free the memory allocated
spdk_sock_placement_id_entry.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ie614dc17334b21b8904b16ee7e6e68a24e29d6a3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463725
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:
Ziye Yang 2019-07-31 21:59:38 +08:00 committed by Changpeng Liu
parent 7751fe08b2
commit a2dcdde2da

View File

@ -103,6 +103,7 @@ spdk_sock_map_release(int placement_id)
entry->ref--;
if (!entry->ref) {
STAILQ_REMOVE(&g_placement_id_map, entry, spdk_sock_placement_id_entry, link);
free(entry);
}
break;
}
@ -139,6 +140,7 @@ spdk_sock_remove_sock_group_from_map_table(struct spdk_sock_group *group)
STAILQ_FOREACH_SAFE(entry, &g_placement_id_map, link, tmp) {
if (entry->group == group) {
STAILQ_REMOVE(&g_placement_id_map, entry, spdk_sock_placement_id_entry, link);
free(entry);
}
}
pthread_mutex_unlock(&g_map_table_mutex);