sock/ssl: free SSL resources in case of failures
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Ifba581c92269c675b03b67586b1fea0b096f9e95 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14511 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
488d6e84c4
commit
35a71c7748
@ -948,6 +948,8 @@ retry:
|
|||||||
flag = fcntl(fd, F_GETFL);
|
flag = fcntl(fd, F_GETFL);
|
||||||
if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
|
if (fcntl(fd, F_SETFL, flag | O_NONBLOCK) < 0) {
|
||||||
SPDK_ERRLOG("fcntl can't set nonblocking mode for socket, fd: %d (%d)\n", fd, errno);
|
SPDK_ERRLOG("fcntl can't set nonblocking mode for socket, fd: %d (%d)\n", fd, errno);
|
||||||
|
SSL_free(ssl);
|
||||||
|
SSL_CTX_free(ctx);
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
break;
|
break;
|
||||||
@ -966,6 +968,8 @@ retry:
|
|||||||
sock = posix_sock_alloc(fd, &impl_opts, enable_zcopy_user_opts && enable_zcopy_impl_opts);
|
sock = posix_sock_alloc(fd, &impl_opts, enable_zcopy_user_opts && enable_zcopy_impl_opts);
|
||||||
if (sock == NULL) {
|
if (sock == NULL) {
|
||||||
SPDK_ERRLOG("sock allocation failed\n");
|
SPDK_ERRLOG("sock allocation failed\n");
|
||||||
|
SSL_free(ssl);
|
||||||
|
SSL_CTX_free(ctx);
|
||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user