diff --git a/src/ssb.c b/src/ssb.c index 50bf0b3a..0b90dec5 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2198,10 +2198,8 @@ void tf_ssb_connect_str(tf_ssb_t* ssb, const char* address) static void _tf_ssb_on_broadcast_listener_alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { - tf_ssb_connection_t* connection = handle->data; - size_t malloc_size = sizeof(connection->recv_buffer) - connection->recv_size; - buf->base = malloc_size ? malloc(malloc_size) : NULL; - buf->len = malloc_size; + buf->base = malloc(suggested_size); + buf->len = suggested_size; } static void _tf_ssb_notify_broadcasts_changed(tf_ssb_t* ssb) diff --git a/src/task.c b/src/task.c index 721dcc78..25766651 100644 --- a/src/task.c +++ b/src/task.c @@ -789,6 +789,7 @@ void tf_task_on_receive_packet(int packetType, const char* begin, size_t length, { _tf_task_sendPromiseResolve(to, from, promise, result); } + JS_FreeValue(to->_context, result); } break; case kResolvePromise: