From ce293647d5a63726c05260ca0e0f65a50e604ebb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 27 Dec 2017 19:16:15 +0100 Subject: ChannelEndPoint.cpp: fix possible memleak in getUnixPath() --- nxcomp/src/ChannelEndPoint.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'nxcomp/src/ChannelEndPoint.cpp') 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; } -- cgit v1.2.3