From 11deabd325f252b900754b2830cd2b600c302ca1 Mon Sep 17 00:00:00 2001 From: dscho Date: Thu, 25 Apr 2002 14:19:04 +0000 Subject: [PATCH] x11vnc memleaks patched --- Makefile | 2 +- x11vnc.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 61e75c2..6c51b1d 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ OSXvnc-server: mac.o libvncserver.a x11vnc.o: x11vnc.c 1instance.c x11vnc: x11vnc.o libvncserver.a - $(CC) -o x11vnc x11vnc.o $(LIBS) $(XLIBS) + $(CC) -g -o x11vnc x11vnc.o $(LIBS) $(XLIBS) x11vnc_static: x11vnc.o libvncserver.a $(CC) -o x11vnc_static x11vnc.o libvncserver.a /usr/lib/libz.a /usr/lib/libjpeg.a $(XLIBS) diff --git a/x11vnc.c b/x11vnc.c index 922ba84..2ffb7e6 100644 --- a/x11vnc.c +++ b/x11vnc.c @@ -73,11 +73,13 @@ void init_keycodes() XFree ((char *) keymap); } +static Bool shutDownServer=0; + /* the hooks */ void clientGone(rfbClientPtr cl) { - exit(0); + shutDownServer=-1; } enum rfbNewClientAction newClient(rfbClientPtr cl) @@ -502,6 +504,15 @@ int main(int argc,char** argv) #endif rfbProcessEvents(screen,-1); + if(shutDownServer) { + free(backupImage); + rfbScreenCleanup(screen); + XFree(dpy); +#ifndef NO_SHM + XShmDetach(dpy,framebufferImage); +#endif + exit(0); + } if(dontTile) { if(gotInput) {