Skip to content

Commit

Permalink
Fix memory leaks in wolfSSL sock_tls
Browse files Browse the repository at this point in the history
  • Loading branch information
Flole998 committed Jan 24, 2023
1 parent 7157ff3 commit 952cacb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/wolfssl/sock_tls/sock_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int sock_dtls_create(sock_tls_t *sock, const sock_udp_ep_t *local, const sock_ud

static int tls_session_create(sock_tls_t *sk)
{
if (!sk || !sk->ctx)
if (!sk || sk->ctx)
return -EINVAL;
sk->ssl = wolfSSL_new(sk->ctx);
if (sk->ssl == NULL) {
Expand All @@ -65,7 +65,7 @@ static int tls_session_create(sock_tls_t *sk)

static void tls_session_destroy(sock_tls_t *sk)
{
if (!sk || sk->ssl)
if (!sk || !sk->ssl)
return;
wolfSSL_free(sk->ssl);
}
Expand Down

0 comments on commit 952cacb

Please sign in to comment.