sock: fix socket memory free
Memory for socket structure is allocated in the selected net framework but freed in the libsocket on the higher level. This patch moves memory free to the net framework implementation. Change-Id: Ia3d4e1553a858a38beb390986e9af105778c12c7 Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com> Reviewed-on: https://review.gerrithub.io/421587 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
8680bea106
commit
349f43c2fc
@ -329,8 +329,14 @@ static int
|
||||
spdk_posix_sock_close(struct spdk_sock *_sock)
|
||||
{
|
||||
struct spdk_posix_sock *sock = __posix_sock(_sock);
|
||||
int rc;
|
||||
|
||||
return close(sock->fd);
|
||||
rc = close(sock->fd);
|
||||
if (rc == 0) {
|
||||
free(sock);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
|
@ -111,7 +111,6 @@ spdk_sock_close(struct spdk_sock **sock)
|
||||
|
||||
rc = (*sock)->net_impl->close(*sock);
|
||||
if (rc == 0) {
|
||||
free(*sock);
|
||||
*sock = NULL;
|
||||
}
|
||||
|
||||
|
@ -346,6 +346,7 @@ spdk_vpp_sock_close(struct spdk_sock *_sock)
|
||||
errno = -rc;
|
||||
return -1;
|
||||
}
|
||||
free(sock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -144,6 +144,7 @@ spdk_ut_sock_close(struct spdk_sock *_sock)
|
||||
if (sock == g_ut_client_sock) {
|
||||
g_ut_client_sock = NULL;
|
||||
}
|
||||
free(_sock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user