Bug 5297 - tlclient leaks MD5 hash handle
Summary: tlclient leaks MD5 hash handle
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Client (show other bugs)
Version: pre-1.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.8.0
Assignee: Samuel Mannehed
Keywords: prosaic
Depends on:
Reported: 2014-10-14 16:46 CEST by Pierre Ossman
Modified: 2017-03-20 16:54 CET (History)
3 users (show)

See Also:
Acceptance Criteria:


Description Pierre Ossman cendio 2014-10-14 16:46:29 CEST
From bug 2723:

Small memory leak as we forget to free the MD5 context:

> ==9384== 156 bytes in 1 blocks are definitely lost in loss record 449 of 652
> ==9384==    at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==9384==    by 0x445D6C: ne_malloc (in /opt/thinlinc/lib/tlclient/tlclient.bin)
> ==9384==    by 0x445E71: ne_md5_create_ctx (in /opt/thinlinc/lib/tlclient/tlclient.bin)
> ==9384==    by 0x430354: TLUtils::MD5(std::string const&, void*) (tlclient_util.cc:776)
> ==9384==    by 0x429D07: SSHTunnel::HostKeyFingerprint(std::string const&) (tlclient_ssh.cc:1652)
> ==9384==    by 0x42BE05: SSHTunnel::VerifyHostKey(std::string const&, std::string const&, int, std::string const&) (tlclient_ssh.cc:1558)
> ==9384==    by 0x42D526: SSHTunnel::ProcessLine(std::string const&) (tlclient_ssh.cc:1367)
> ==9384==    by 0x42DC05: SSHTunnel::ProcessBuffer(char const*, std::string*) (tlclient_ssh.cc:1084)
> ==9384==    by 0x42E14F: SSHTunnel::Connect(ArgVector, char const*) (tlclient_ssh.cc:972)
> ==9384==    by 0x42EFC9: SSHTunnel::EstablishTunnel() (tlclient_ssh.cc:848)
> ==9384==    by 0x42865B: Session::ConnectMaster() (tlclient_session.cc:369)
> ==9384==    by 0x40FC02: MainWindow::DoLogin(std::string, std::string, std::string, std::string, pkcs11_certificate const*, std::string const&, std::string, bool) (tlclient_mainwindow.cc:823)
Comment 2 Samuel Mannehed cendio 2016-12-16 13:35:38 CET
Fixed now. I ran valgrind as described here: https://intranet.lkpg.cendio.se/ThinLinc/Testing#Run_tlclient_in_valgrind

I used tlclient debug build 5320 and verified that valgrind complained about the memory leak after removing it from the suppression file. While running valgrind, I had to login using the client to use the code that contained the memory leak. After fixing the code, I built a new tlclient binary and used valgrind to verify that it no longer found any memory leak with regards to MD5.
Comment 3 Henrik Andersson cendio 2016-12-22 10:12:00 CET
Valgrind supression file is not updated on bug #2723
Comment 4 Henrik Andersson cendio 2016-12-22 10:25:10 CET
(In reply to comment #3)
> Valgrind supression file is not updated on bug #2723

This is now fixed.
Comment 5 Henrik Andersson cendio 2016-12-22 10:26:13 CET
Verified that build 5325 does not leak any md5 handles now when they are destroyed after use.

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