All the leaks.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3919 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-06-26 18:25:31 +00:00
parent 66ea0dadd0
commit ff2a0f0c3f
9 changed files with 50 additions and 24 deletions

View File

@ -258,6 +258,7 @@ void _socket_close_internal(socket_t* socket)
{
_sockets[i] = _sockets[_sockets_count - 1];
--_sockets_count;
_sockets = tf_realloc(_sockets, sizeof(socket_t*) * _sockets_count);
break;
}
}
@ -870,10 +871,13 @@ int _socket_writeBytes(socket_t* socket, promiseid_t promise, int (*callback)(so
size_t offset;
size_t element_size;
JSValue buffer = tf_util_try_get_typed_array_buffer(context, value, &offset, &length, &element_size);
size_t size;
if ((array = tf_util_try_get_array_buffer(context, &size, buffer)) != 0)
if (!JS_IsException(buffer))
{
result = callback(socket, promise, (const char*)array, length);
size_t size;
if ((array = tf_util_try_get_array_buffer(context, &size, buffer)) != 0)
{
result = callback(socket, promise, (const char*)array, length);
}
}
JS_FreeValue(context, buffer);
}