memleaks patched

pull/1/head
dscho 21 years ago
parent 160c85f4ec
commit efa12fa978

@ -1,3 +1,5 @@
memory leaks squashed (localtime pseudo leak is still there :-)
small improvements for OSXvnc (still not working correctly)
synced with TightVNC 1.2.3
solaris compile cleanups
many x11vnc improvements

@ -272,6 +272,8 @@ char* rfbMakeMaskForXCursor(int width,int height,char* source)
void rfbFreeCursor(rfbCursorPtr cursor)
{
if(cursor) {
if(cursor->richSource)
free(cursor->richSource);
free(cursor->source);
free(cursor->mask);
free(cursor);

@ -262,6 +262,17 @@ int main(int argc,char** argv)
/* initialize the server */
rfbInitServer(rfbScreen);
#define USE_OWN_LOOP
#ifdef USE_OWN_LOOP
{
int i;
for(i=0;i<200;i++) {
fprintf(stderr,"%d\r",i);
rfbProcessEvents(rfbScreen,100000);
}
}
#else
#ifndef BACKGROUND_LOOP_TEST
/* this is the blocking event loop, i.e. it never returns */
/* 40000 are the microseconds, i.e. 0.04 seconds */
@ -274,6 +285,11 @@ int main(int argc,char** argv)
rfbRunEventLoop(rfbScreen,-1,TRUE);
/* now we could do some cool things like rendering */
while(1) sleep(5); /* render(); */
#endif
rfbFreeCursor(rfbScreen->cursor);
free(rfbScreen->frameBuffer);
rfbScreenCleanup(rfbScreen);
return(0);
}

@ -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);
}

@ -124,6 +124,7 @@ void
rfbReleaseClientIterator(rfbClientIteratorPtr iterator)
{
IF_PTHREADS(if(iterator->next) rfbDecrClientRef(iterator->next));
free(iterator);
}
@ -372,6 +373,8 @@ rfbClientConnectionGone(cl)
pointerClient = NULL;
sraRgnDestroy(cl->modifiedRegion);
sraRgnDestroy(cl->requestedRegion);
sraRgnDestroy(cl->copyRegion);
UNLOCK(rfbClientListMutex);
@ -1123,6 +1126,7 @@ rfbSendFramebufferUpdate(cl, givenUpdateRegion)
break;
}
}
sraRgnReleaseIterator(i);
if ( nUpdateRegionRects == 0xFFFF &&
!rfbSendLastRectMarker(cl) ) {

Loading…
Cancel
Save