Skip to content

Commit

Permalink
extmod/modssl_mbedtls: Clear sock member if error creating SSLSocket.
Browse files Browse the repository at this point in the history
Otherwise if/when the finaliser runs for this newly created SSLSocket the
mbedtls state will be freed again.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Aug 30, 2023
1 parent f3eccb1 commit 313068a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions extmod/modssl_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t
return MP_OBJ_FROM_PTR(o);

cleanup:
o->sock = MP_OBJ_NULL;
mbedtls_ssl_free(&o->ssl);
mbedtls_raise_error(ret);
}
Expand Down

0 comments on commit 313068a

Please sign in to comment.