Bug 5303 - fix memory leaks in vncviewer
Summary: fix memory leaks in vncviewer
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: VNC (show other bugs)
Version: pre-1.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: MediumPrio
Assignee: Pierre Ossman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-14 16:55 CEST by Pierre Ossman
Modified: 2018-03-19 16:46 CET (History)
2 users (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2014-10-14 16:55:30 CEST
From bug 2723:


* vncviewer also manages to leak some memory on its own. One offender is that
parameters return strings that need to be freed:

> ==10083== 1 bytes in 1 blocks are definitely lost in loss record 1 of 541
> ==10083==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==10083==    by 0x5714AC: operator new(unsigned long) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x56EDF8: operator new[](unsigned long) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x4700F0: rfb::strDup(char const*) (util.cxx:46)
> ==10083==    by 0x4593F0: main (vncviewer.cxx:550)
> ==10083== 
> ==10083== 9 bytes in 1 blocks are definitely lost in loss record 25 of 541
> ==10083==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==10083==    by 0x5714AC: operator new(unsigned long) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x56EDF8: operator new[](unsigned long) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x4700F0: rfb::strDup(char const*) (util.cxx:46)
> ==10083==    by 0x4514E9: DesktopWindow::updateWindow() (DesktopWindow.cxx:663)
> ==10083==    by 0x44E43F: CConn::framebufferUpdateEnd() (CConn.cxx:337)
> ==10083==    by 0x45C93F: rfb::CMsgReader::readMsg() (CMsgReader.cxx:112)
> ==10083==    by 0x44D5C7: CConn::socketEvent(int, void*) (CConn.cxx:244)
> ==10083==    by 0x4AA158: fl_wait(double) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x48DA74: Fl::wait(double) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x45920D: main (vncviewer.cxx:564)

* Another instance is that the security object isn't cleaned up:

> ==10083== 8 bytes in 1 blocks are definitely lost in loss record 21 of 541
> ==10083==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==10083==    by 0x5714AC: operator new(unsigned long) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x469CD9: rfb::SecurityClient::GetCSecurity(unsigned int) (SecurityClient.cxx:70)
> ==10083==    by 0x470A3C: rfb::CSecurityVeNCrypt::processMsg(rfb::CConnection*) (CSecurityVeNCrypt.cxx:174)
> ==10083==    by 0x45A938: rfb::CConnection::processSecurityMsg() (CConnection.cxx:202)
> ==10083==    by 0x44D5C7: CConn::socketEvent(int, void*) (CConn.cxx:244)
> ==10083==    by 0x4AA158: fl_wait(double) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x48DA74: Fl::wait(double) (in /opt/thinlinc/lib/tlclient/vncviewer)
> ==10083==    by 0x45920D: main (vncviewer.cxx:564)
Comment 1 Henrik Andersson cendio 2015-05-13 07:45:27 CEST
* rfb::CConnection isn't cleaned up as it should:

==9418== 64 (16 direct, 48 indirect) bytes in 1 blocks are definitely lost in loss record 242 of 442
==9418==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9418==    by 0x5A597C: operator new(unsigned long) (new_op.cc:52)
==9418==    by 0x4599DF: rfb::CConnection::CConnection() (CConnection.cxx:40)
==9418==    by 0x44EAD5: CConn::CConn(char const*, network::Socket*) (CConn.cxx:79)
==9418==    by 0x44D5B1: main (vncviewer.cxx:720)
Comment 2 Samuel Mannehed cendio 2018-03-19 16:46:55 CET
* memory leak in tlclient_prefix handling:

==12851== 37 bytes in 1 blocks are definitely lost in loss record 138 of 291
==12851==    at 0x4C2FB6B: malloc (vg_replace_malloc.c:299)
==12851==    by 0x5B9F639: strdup (in /usr/lib64/libc-2.26.so)
==12851==    by 0x49A653: main (vncviewer.cxx:529)

Note You need to log in before you can comment on or make changes to this bug.