Commit c4660e10 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mihai Moldovan

ChannelEndPoint.cpp: fix two memleaks

parent 21c742d2
...@@ -54,6 +54,12 @@ ChannelEndPoint::~ChannelEndPoint() ...@@ -54,6 +54,12 @@ ChannelEndPoint::~ChannelEndPoint()
if(S_ISSOCK(st.st_mode)) if(S_ISSOCK(st.st_mode))
unlink(unixPath); unlink(unixPath);
} }
free(unixPath);
unixPath = NULL;
free(defaultUnixPath_);
defaultUnixPath_ = NULL;
free(spec_);
spec_ = NULL;
} }
void void
...@@ -90,12 +96,12 @@ void ...@@ -90,12 +96,12 @@ void
ChannelEndPoint::setSpec(const char *hostName, long port) { ChannelEndPoint::setSpec(const char *hostName, long port) {
int length; int length;
free(spec_);
spec_ = NULL;
isUnix_ = false; isUnix_ = false;
isTCP_ = false; isTCP_ = false;
free(spec_);
spec_ = NULL;
if (hostName && strlen(hostName) && port >= 1) if (hostName && strlen(hostName) && port >= 1)
{ {
length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port);
...@@ -195,7 +201,7 @@ ChannelEndPoint::getPort(long *port) const { ...@@ -195,7 +201,7 @@ ChannelEndPoint::getPort(long *port) const {
bool bool
ChannelEndPoint::getUnixPath(char **unixPath) const { ChannelEndPoint::getUnixPath(char **unixPath) const {
if (unixPath) *unixPath = 0; if (unixPath) *unixPath = NULL;
long p; long p;
char *path = NULL; char *path = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment