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:
parent
a5a296dc9f
commit
685cbeebd4
@ -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);
|
||||
|
@ -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 = {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user