Commit fba4818a authored by George Fleury's avatar George Fleury Committed by Johannes Schindelin

Fix memory leak

I was debbuging some code tonight and i found a pointer that is not been
freed, so i think there is maybe a memory leak, so it is...

there is the malloc caller reverse order:

( malloc cl->statEncList )
	<- rfbStatLookupEncoding
	<- rfbStatRecordEncodingSent
	<- rfbSendCursorPos
	<- rfbSendFramebufferUpdate
	<- rfbProcessEvents

I didnt look the whole libvncserver api, but i am using
rfbReverseConnection with rfbProcessEvents, and then when the client
connection dies, i am calling a rfbShutdownServer and rfbScreenCleanup,
but the malloc at rfbStatLookupEncoding isnt been freed.

So to free the stats i added a rfbResetStats(cl) after rfbPrintStats(cl)
at rfbClientConnectionGone in rfbserver.c before free the cl pointer. (at
rfbserver.c line 555). And this, obviously, is correcting the memory leak.
Signed-off-by: 's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent 9d0b8005
...@@ -569,6 +569,7 @@ rfbClientConnectionGone(rfbClientPtr cl) ...@@ -569,6 +569,7 @@ rfbClientConnectionGone(rfbClientPtr cl)
TINI_MUTEX(cl->sendMutex); TINI_MUTEX(cl->sendMutex);
rfbPrintStats(cl); rfbPrintStats(cl);
rfbResetStats(cl);
free(cl); free(cl);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment