sock: do not free group_impl in generic layer

Have each sock implementation free the group_impl itself.
This allows C++ based sock implementations like Seastar
to release the group_impl memory using delete rather
than free.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If40a91e8bc93a531701fc30d847ab28fa11858ab

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469618
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Jim Harris 2019-09-24 12:08:50 -07:00
parent a5a296dc9f
commit 685cbeebd4
4 changed files with 6 additions and 2 deletions

View File

@ -516,7 +516,6 @@ spdk_sock_group_close(struct spdk_sock_group **group)
SPDK_ERRLOG("group_impl_close for net(%s) failed\n",
group_impl->net_impl->name);
}
free(group_impl);
}
spdk_sock_remove_sock_group_from_map_table(*group);

View File

@ -639,8 +639,11 @@ static int
spdk_posix_sock_group_impl_close(struct spdk_sock_group_impl *_group)
{
struct spdk_posix_sock_group_impl *group = __posix_group_impl(_group);
int rc;
return close(group->fd);
rc = close(group->fd);
free(group);
return rc;
}
static struct spdk_net_impl g_posix_net_impl = {

View File

@ -1110,6 +1110,7 @@ spdk_vpp_sock_group_impl_poll(struct spdk_sock_group_impl *_group, int max_event
static int
spdk_vpp_sock_group_impl_close(struct spdk_sock_group_impl *_group)
{
free(_group);
return 0;
}

View File

@ -310,6 +310,7 @@ spdk_ut_sock_group_impl_close(struct spdk_sock_group_impl *_group)
struct spdk_ut_sock_group_impl *group = __ut_group(_group);
CU_ASSERT(group->sock == NULL);
free(_group);
return 0;
}