summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authordscho <dscho>2002-04-25 13:41:52 +0000
committerdscho <dscho>2002-04-25 13:41:52 +0000
commitefa12fa978ca10c329e4cb14fefa597a6d93f2e8 (patch)
tree5ee9b933785b16c810a3ba5962afb4f7596cbd58 /main.c
parent160c85f4ecd37b9ab046403e0bc1b5f834a9c3d4 (diff)
downloadlibtdevnc-efa12fa978ca10c329e4cb14fefa597a6d93f2e8.tar.gz
libtdevnc-efa12fa978ca10c329e4cb14fefa597a6d93f2e8.zip
memleaks patched
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 13 insertions, 3 deletions
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);
}