aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-12-27 17:06:43 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-12-29 02:31:26 +0100
commiteae64c4a4282eb2b511ba11c6db51d00a3b49833 (patch)
tree616da23589aec17b979e588e55f787b402dd5fbb /nxcomp/src
parent96879dc69ed4004375bcfbf334e598ea55f19326 (diff)
downloadnx-libs-eae64c4a4282eb2b511ba11c6db51d00a3b49833.tar.gz
nx-libs-eae64c4a4282eb2b511ba11c6db51d00a3b49833.tar.bz2
nx-libs-eae64c4a4282eb2b511ba11c6db51d00a3b49833.zip
ChannelEndPoint.cpp: fix another memleak
==7689== 50 bytes in 5 blocks are definitely lost in loss record 1 of 2 ==7689== at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==7689== by 0x54074D9: strndup (strndup.c:43) ==7689== by 0x4E7D803: ChannelEndPoint::getTCPHostAndPort(char**, long*) const (ChannelEndPoint.cpp:309) ==7689== by 0x4EC9D93: ConnectToRemote(ChannelEndPoint&) [clone .constprop.144] (Loop.cpp:6660) ==7689== by 0x4ECB94E: SetupProxyConnection() (Loop.cpp:3204) ==7689== by 0x4ECE824: handleNegotiationInLoop(int&, fd_set&, fd_set&, timeval&) [clone .isra.129] (Loop.cpp:14312) ==7689== by 0x4ED0F8A: NXTransPrepare (Loop.cpp:2575) ==7689== by 0x4ED1C35: NXTransContinue (Loop.cpp:1609) ==7689== by 0x4ED1D7B: WaitCleanup() (Loop.cpp:4440) ==7689== by 0x4ED2343: NXTransProxy (Loop.cpp:1234) ==7689== by 0x400B2A: main (Main.c:111)
Diffstat (limited to 'nxcomp/src')
-rw-r--r--nxcomp/src/ChannelEndPoint.cpp6
-rw-r--r--nxcomp/src/Loop.cpp2
-rw-r--r--nxcomp/src/Proxy.cpp2
3 files changed, 7 insertions, 3 deletions
diff --git a/nxcomp/src/ChannelEndPoint.cpp b/nxcomp/src/ChannelEndPoint.cpp
index 2abc0ee6a..de881835c 100644
--- a/nxcomp/src/ChannelEndPoint.cpp
+++ b/nxcomp/src/ChannelEndPoint.cpp
@@ -273,8 +273,10 @@ ChannelEndPoint::getTCPHostAndPort(char **host, long *port) const {
char *h = NULL;
ssize_t h_len;
- if (host) *host = NULL;
- if (port) *port = 0;
+ if (host)
+ *host = NULL;
+ if (port)
+ *port = 0;
if (getPort(&p)) {
h_len = 0;
diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp
index 3ee094efb..ab7ea5a0f 100644
--- a/nxcomp/src/Loop.cpp
+++ b/nxcomp/src/Loop.cpp
@@ -6660,6 +6660,8 @@ int ConnectToRemote(ChannelEndPoint &socketAddress)
<< " in process with pid '" << getpid()
<< "'.\n" << std::flush;
+ SAFE_FREE(hostName);
+
if (socketAddress.getUnixPath(&unixPath))
result = PrepareProxyConnectionUnix(&unixPath, &connectTimeout, &pFD, &reason);
else if (socketAddress.getTCPHostAndPort(&hostName, &portNum))
diff --git a/nxcomp/src/Proxy.cpp b/nxcomp/src/Proxy.cpp
index 963ae3d75..71ea090e6 100644
--- a/nxcomp/src/Proxy.cpp
+++ b/nxcomp/src/Proxy.cpp
@@ -6123,7 +6123,7 @@ int Proxy::handleNewSlaveConnection(int clientFd)
int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
ChannelEndPoint &endPoint, const char *label)
{
- char *unixPath, *host;
+ char *unixPath, *host = NULL;
long port;
if (endPoint.getUnixPath(&unixPath)) {