Fix socket leaks.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3818 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-02-05 17:06:51 +00:00
parent e85ee5766b
commit 8ecc07452e
2 changed files with 52 additions and 21 deletions

View File

@ -260,7 +260,7 @@ static void _tf_ssb_connection_on_tcp_alloc(uv_handle_t* handle, size_t suggeste
{
tf_ssb_connection_t* connection = handle->data;
size_t malloc_size = sizeof(connection->recv_buffer) - connection->recv_size;
buf->base = malloc(malloc_size);
buf->base = malloc_size ? malloc(malloc_size) : NULL;
buf->len = malloc_size;
}
@ -2200,7 +2200,7 @@ static void _tf_ssb_on_broadcast_listener_alloc(uv_handle_t* handle, size_t sugg
{
tf_ssb_connection_t* connection = handle->data;
size_t malloc_size = sizeof(connection->recv_buffer) - connection->recv_size;
buf->base = malloc(malloc_size);
buf->base = malloc_size ? malloc(malloc_size) : NULL;
buf->len = malloc_size;
}