From efa12fa978ca10c329e4cb14fefa597a6d93f2e8 Mon Sep 17 00:00:00 2001 From: dscho Date: Thu, 25 Apr 2002 13:41:52 +0000 Subject: memleaks patched --- main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index c9f8f85..b534ea3 100644 --- a/main.c +++ b/main.c @@ -55,7 +55,7 @@ rfbLog(const char *format, ...) time(&log_clock); strftime(buf, 255, "%d/%m/%Y %T ", localtime(&log_clock)); - fprintf(stderr, buf); + fprintf(stderr,buf); vfprintf(stderr, format, args); fflush(stderr); @@ -583,9 +583,19 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, void rfbScreenCleanup(rfbScreenInfoPtr rfbScreen) { + rfbClientIteratorPtr i=rfbGetClientIterator(rfbScreen); + rfbClientPtr cl,cl1=rfbClientIteratorNext(i); + while(cl1) { + cl=rfbClientIteratorNext(i); + rfbClientConnectionGone(cl1); + cl1=cl; + } + rfbReleaseClientIterator(i); + /* TODO: hang up on all clients and free all reserved memory */ - if(rfbScreen->colourMap.data.bytes) - free(rfbScreen->colourMap.data.bytes); +#define FREE_IF(x) if(rfbScreen->x) free(rfbScreen->x) + FREE_IF(colourMap.data.bytes); + FREE_IF(underCursorBuffer); TINI_MUTEX(rfbScreen->cursorMutex); free(rfbScreen); } -- cgit v1.2.1