extmod/modssl_mbedtls: Clear sock member if error creating SSLSocket.

Otherwise if/when the finaliser runs for this newly created SSLSocket the
mbedtls state will be freed again.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2023-08-30 13:52:31 +10:00
parent f3eccb154c
commit 313068a5b3

View File

@ -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);
}