summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorGeorge Fleury <[email protected]>2011-10-16 22:02:11 -0500
committerJohannes Schindelin <[email protected]>2011-10-16 22:04:12 -0500
commitfba4818ae850fb8b8b493a12fbb052f5f847489e (patch)
treec48ca37a542b16629185eb810139285627382b1b /libvncserver
parent9d0b80059a105ce68edef8e12161e73ec9a4eda7 (diff)
downloadlibtdevnc-fba4818ae850fb8b8b493a12fbb052f5f847489e.tar.gz
libtdevnc-fba4818ae850fb8b8b493a12fbb052f5f847489e.zip
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: Johannes Schindelin <[email protected]>
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/rfbserver.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libvncserver/rfbserver.c b/libvncserver/rfbserver.c
index 63f21db..cb37da3 100644
--- a/libvncserver/rfbserver.c
+++ b/libvncserver/rfbserver.c
@@ -569,6 +569,7 @@ rfbClientConnectionGone(rfbClientPtr cl)
TINI_MUTEX(cl->sendMutex);
rfbPrintStats(cl);
+ rfbResetStats(cl);
free(cl);
}