File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) {
119
119
socket_obj_t * self = MP_OBJ_TO_PTR (arg0 );
120
120
int x = lwip_accept (self -> fd , NULL , NULL );
121
121
if (x >= 0 ) {
122
- socket_obj_t * sock = (socket_obj_t * ) calloc ( 1 , sizeof ( socket_obj_t ) );
122
+ socket_obj_t * sock = m_new_obj_with_finaliser (socket_obj_t );
123
123
sock -> base .type = self -> base .type ;
124
124
sock -> fd = x ;
125
125
return MP_OBJ_FROM_PTR (sock );
@@ -315,7 +315,7 @@ STATIC const mp_obj_type_t socket_type = {
315
315
316
316
STATIC mp_obj_t get_socket (mp_uint_t n_args , const mp_obj_t * args ) {
317
317
// XXX TODO support for UDP and RAW.
318
- socket_obj_t * sock = (socket_obj_t * ) calloc ( 1 , sizeof ( socket_obj_t ) );
318
+ socket_obj_t * sock = m_new_obj_with_finaliser (socket_obj_t );
319
319
sock -> base .type = & socket_type ;
320
320
sock -> domain = AF_INET ;
321
321
sock -> type = SOCK_STREAM ;
You can’t perform that action at this time.
0 commit comments