Skip to content

Commit 18a15ed

Browse files
add free'ing of ssl object on error
1 parent 6e5a8df commit 18a15ed

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

port/posix/posix_transport_tls.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ int posixTransportTls_RecvRequest(void* context, uint16_t* out_size, void* data)
491491
/* Set the socket file descriptor */
492492
rc = wolfSSL_set_fd(ctx->ssl, ctx->accept_fd_p1 - 1);
493493
if (rc != WOLFSSL_SUCCESS) {
494+
wolfSSL_free(ctx->ssl);
495+
ctx->ssl = NULL;
494496
return WH_ERROR_ABORTED;
495497
}
496498

@@ -502,6 +504,8 @@ int posixTransportTls_RecvRequest(void* context, uint16_t* out_size, void* data)
502504
err == WOLFSSL_ERROR_WANT_WRITE) {
503505
return WH_ERROR_NOTREADY;
504506
}
507+
wolfSSL_free(ctx->ssl);
508+
ctx->ssl = NULL;
505509
return WH_ERROR_ABORTED;
506510
}
507511

0 commit comments

Comments
 (0)