aboutsummaryrefslogtreecommitdiff
path: root/nxcomp
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-11-28 20:43:44 +0100
committerMihai Moldovan <ionic@ionic.de>2017-12-09 13:15:35 +0100
commitc4660e109aabc78abda4b80d637312385223537f (patch)
treec7364916416032730bbb35299ccf7e94416e83dc /nxcomp
parent21c742d25361e7ae2dc40f635890f60e6eb0e1d6 (diff)
downloadnx-libs-c4660e109aabc78abda4b80d637312385223537f.tar.gz
nx-libs-c4660e109aabc78abda4b80d637312385223537f.tar.bz2
nx-libs-c4660e109aabc78abda4b80d637312385223537f.zip
ChannelEndPoint.cpp: fix two memleaks
Diffstat (limited to 'nxcomp')
-rw-r--r--nxcomp/src/ChannelEndPoint.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/nxcomp/src/ChannelEndPoint.cpp b/nxcomp/src/ChannelEndPoint.cpp
index 8cc0c1d41..843bf2b35 100644
--- a/nxcomp/src/ChannelEndPoint.cpp
+++ b/nxcomp/src/ChannelEndPoint.cpp
@@ -54,6 +54,12 @@ ChannelEndPoint::~ChannelEndPoint()
if(S_ISSOCK(st.st_mode))
unlink(unixPath);
}
+ free(unixPath);
+ unixPath = NULL;
+ free(defaultUnixPath_);
+ defaultUnixPath_ = NULL;
+ free(spec_);
+ spec_ = NULL;
}
void
@@ -90,12 +96,12 @@ void
ChannelEndPoint::setSpec(const char *hostName, long port) {
int length;
- free(spec_);
- spec_ = NULL;
-
isUnix_ = false;
isTCP_ = false;
+ free(spec_);
+ spec_ = NULL;
+
if (hostName && strlen(hostName) && port >= 1)
{
length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port);
@@ -195,7 +201,7 @@ ChannelEndPoint::getPort(long *port) const {
bool
ChannelEndPoint::getUnixPath(char **unixPath) const {
- if (unixPath) *unixPath = 0;
+ if (unixPath) *unixPath = NULL;
long p;
char *path = NULL;