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