Commit 21c742d2 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mihai Moldovan

nxcomp: simplify free calls

free() can handle NULL itself
parent 513aa23a
......@@ -58,7 +58,7 @@ ChannelEndPoint::~ChannelEndPoint()
void
ChannelEndPoint::setSpec(const char *spec) {
if (spec_) free(spec_);
free(spec_);
if (spec && strlen(spec))
{
......@@ -90,7 +90,7 @@ void
ChannelEndPoint::setSpec(const char *hostName, long port) {
int length;
if (spec_) free(spec_);
free(spec_);
spec_ = NULL;
isUnix_ = false;
......@@ -162,7 +162,7 @@ ChannelEndPoint::setDefaultTCPInterface(int publicInterface) {
void
ChannelEndPoint::setDefaultUnixPath(char *path) {
if (defaultUnixPath_) free(defaultUnixPath_);
free(defaultUnixPath_);
if (path && strlen(path))
defaultUnixPath_ = strdup(path);
......
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