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()
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;
......
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