From fe30cd3073bc478b1dfb3073c380c4598be2dc64 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 19 Oct 2012 14:24:03 -0700 Subject: [PATCH] Handle nested socket within stream alloc/free. --- libguac/src/client.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libguac/src/client.c b/libguac/src/client.c index 814048b0..cf96e428 100644 --- a/libguac/src/client.c +++ b/libguac/src/client.c @@ -101,6 +101,12 @@ guac_stream* guac_client_alloc_stream(guac_client* client) { guac_stream* allocd_stream = malloc(sizeof(guac_stream)); allocd_stream->index = guac_pool_next_int(client->__stream_pool); + /* Nest socket */ + allocd_stream->socket = guac_socket_nest( + client->socket, + allocd_stream->index + ); + return allocd_stream; } @@ -109,6 +115,9 @@ void guac_client_free_stream(guac_client* client, guac_stream* stream) { /* Release index to pool */ guac_pool_free_int(client->__stream_pool, stream->index - 1); + + /* Release socket */ + guac_socket_free(stream->socket); /* Free stream */ free(stream);