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>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463725 (master)

(cherry picked from commit a2dcdde2da)
Change-Id: Ie614dc17334b21b8904b16ee7e6e68a24e29d6a3
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467126
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ziye Yang 2019-07-31 21:59:38 +08:00 committed by Jim Harris
parent 8228117637
commit 7c8cb1b6fd

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);