summaryrefslogtreecommitdiffstats
path: root/libvncserver/rfbserver.c
diff options
context:
space:
mode:
authorGeorge Fleury <gfleury@gmail.com>2011-10-16 22:02:11 -0500
committerJohannes Schindelin <johannes.schindelin@gmx.de>2011-10-16 22:04:12 -0500
commitfba4818ae850fb8b8b493a12fbb052f5f847489e (patch)
treec48ca37a542b16629185eb810139285627382b1b /libvncserver/rfbserver.c
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 <johannes.schindelin@gmx.de>
Diffstat (limited to 'libvncserver/rfbserver.c')
-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);
}