aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/src/ChannelEndPoint.cpp
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-12-27 19:16:15 +0100
committerUlrich Sibiller <uli42@gmx.de>2017-12-29 02:31:26 +0100
commitce293647d5a63726c05260ca0e0f65a50e604ebb (patch)
tree68da5d82e3f0beb5805c6a7ea0afcbcddb311b1b /nxcomp/src/ChannelEndPoint.cpp
parent17d045826ba98a55696cc56ebf6b56c811bf5392 (diff)
downloadnx-libs-ce293647d5a63726c05260ca0e0f65a50e604ebb.tar.gz
nx-libs-ce293647d5a63726c05260ca0e0f65a50e604ebb.tar.bz2
nx-libs-ce293647d5a63726c05260ca0e0f65a50e604ebb.zip
ChannelEndPoint.cpp: fix possible memleak in getUnixPath()
Diffstat (limited to 'nxcomp/src/ChannelEndPoint.cpp')
-rw-r--r--nxcomp/src/ChannelEndPoint.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/nxcomp/src/ChannelEndPoint.cpp b/nxcomp/src/ChannelEndPoint.cpp
index 443c0f290..7768df137 100644
--- a/nxcomp/src/ChannelEndPoint.cpp
+++ b/nxcomp/src/ChannelEndPoint.cpp
@@ -207,7 +207,10 @@ ChannelEndPoint::getPort(long *port) const {
bool
ChannelEndPoint::getUnixPath(char **unixPath) const {
- if (unixPath) *unixPath = NULL;
+ if (unixPath)
+ *unixPath = NULL;
+ else
+ return false;
long p;
char *path = NULL;
@@ -227,8 +230,7 @@ ChannelEndPoint::getUnixPath(char **unixPath) const {
return false;
}
- if (unixPath)
- *unixPath = strdup(path);
+ *unixPath = strdup(path);
return true;
}