diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index 1e3c49449..c4ce544cb 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -422,14 +422,15 @@ static int spdk_posix_sock_close(struct spdk_sock *_sock) { struct spdk_posix_sock *sock = __posix_sock(_sock); - int rc; - rc = close(sock->fd); - if (rc == 0) { - free(sock); - } + /* If the socket fails to close, the best choice is to + * leak the fd but continue to free the rest of the sock + * memory. */ + close(sock->fd); - return rc; + free(sock); + + return 0; } static ssize_t