From 989f24be2b06c65b3db7cae3d7630e4b1f065ed8 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sat, 26 Nov 2011 14:50:03 -0800 Subject: [PATCH] Do not call free handler for client if init does not complete. --- libguac/include/client.h | 3 +++ libguac/src/client.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libguac/include/client.h b/libguac/include/client.h index 9ee187ef..899093ba 100644 --- a/libguac/include/client.h +++ b/libguac/include/client.h @@ -287,6 +287,9 @@ struct guac_client { * by the proxy, and any data allocated by the proxy client should be * freed. * + * Note that this handler will NOT be called if the client's + * guac_client_init() function fails. + * * Implement this handler if you store data inside the client. * * Example: diff --git a/libguac/src/client.c b/libguac/src/client.c index db53b224..22bb24c5 100644 --- a/libguac/src/client.c +++ b/libguac/src/client.c @@ -210,7 +210,7 @@ guac_client* guac_client_plugin_get_client(guac_client_plugin* plugin, client->__next_buffer_index = -1; if (plugin->init_handler(client, argc, argv) != 0) { - guac_client_free(client); + free(client); return NULL; }