From 61204490ce0931b6593bbf8c84647b0a9200a3e5 Mon Sep 17 00:00:00 2001 From: dscho Date: Wed, 7 Dec 2005 18:35:48 +0000 Subject: plug memory leaks --- libvncclient/vncviewer.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libvncclient') diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 31b4d3d..5ef2d9a 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -159,12 +159,10 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel, client->decompStreamInited = FALSE; #endif -#ifdef LIBVNCSERVER_HAVE_LIBZ #ifdef LIBVNCSERVER_HAVE_LIBJPEG memset(client->zlibStreamActive,0,sizeof(rfbBool)*4); client->jpegSrcManager = NULL; #endif -#endif client->HandleCursorPos = DummyPoint; client->SoftCursorLockArea = DummyRect; @@ -254,6 +252,23 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) { } void rfbClientCleanup(rfbClient* client) { + int i; + + for ( i = 0; i < 4; i++ ) { + if (client->zlibStreamActive[i] == TRUE ) { + if (inflateEnd (&client->zlibStream[i]) != Z_OK && + client->zlibStream[i].msg != NULL) + rfbClientLog("inflateEnd: %s\n", client->zlibStream[i].msg); + } + } + + if ( client->decompStreamInited == TRUE ) { + if (inflateEnd (&client->decompStream) != Z_OK && + client->decompStream.msg != NULL) + rfbClientLog("inflateEnd: %s\n", client->decompStream.msg ); + } + + free(client->desktopName); free(client->serverHost); free(client); } -- cgit v1.1