mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
all: Use mp_obj_malloc_with_finaliser everywhere it's applicable.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -210,11 +210,10 @@ STATIC mp_obj_t ssl_context_make_new(const mp_obj_type_t *type_in, size_t n_args
|
||||
|
||||
// Create SSLContext object.
|
||||
#if MICROPY_PY_SSL_FINALISER
|
||||
mp_obj_ssl_context_t *self = m_new_obj_with_finaliser(mp_obj_ssl_context_t);
|
||||
mp_obj_ssl_context_t *self = mp_obj_malloc_with_finaliser(mp_obj_ssl_context_t, type_in);
|
||||
#else
|
||||
mp_obj_ssl_context_t *self = m_new_obj(mp_obj_ssl_context_t);
|
||||
mp_obj_ssl_context_t *self = mp_obj_malloc(mp_obj_ssl_context_t, type_in);
|
||||
#endif
|
||||
self->base.type = type_in;
|
||||
|
||||
// Initialise mbedTLS state.
|
||||
mbedtls_ssl_config_init(&self->conf);
|
||||
@@ -488,11 +487,10 @@ STATIC mp_obj_t ssl_socket_make_new(mp_obj_ssl_context_t *ssl_context, mp_obj_t
|
||||
mp_get_stream_raise(sock, MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
|
||||
|
||||
#if MICROPY_PY_SSL_FINALISER
|
||||
mp_obj_ssl_socket_t *o = m_new_obj_with_finaliser(mp_obj_ssl_socket_t);
|
||||
mp_obj_ssl_socket_t *o = mp_obj_malloc_with_finaliser(mp_obj_ssl_socket_t, &ssl_socket_type);
|
||||
#else
|
||||
mp_obj_ssl_socket_t *o = m_new_obj(mp_obj_ssl_socket_t);
|
||||
mp_obj_ssl_socket_t *o = mp_obj_malloc(mp_obj_ssl_socket_t, &ssl_socket_type);
|
||||
#endif
|
||||
o->base.type = &ssl_socket_type;
|
||||
o->ssl_context = ssl_context;
|
||||
o->sock = sock;
|
||||
o->poll_mask = 0;
|
||||
|
||||
Reference in New Issue
Block a user