summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-11-08 16:05:52 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-11-08 16:05:52 -0800
commitbe8a5fbefcd6d3bee5e55283e06e255003b376b4 (patch)
tree9b58ff3951141db45835557e8d709d9f90e83fde
parentf391fa1f55436ec2e4f7de4c4734fcd89cdbe250 (diff)
Stop checking if pointers are NULL before passing them to free()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--config.c3
-rw-r--r--main.c36
-rw-r--r--pmdb.c78
3 files changed, 39 insertions, 78 deletions
diff --git a/config.c b/config.c
index 120e35a..1ece142 100644
--- a/config.c
+++ b/config.c
@@ -182,8 +182,7 @@ GetConfig (
found = 1;
}
- if (buf)
- free (buf);
+ free (buf);
fclose (fp);
return found;
diff --git a/main.c b/main.c
index f14fdc2..032262b 100644
--- a/main.c
+++ b/main.c
@@ -539,18 +539,12 @@ PMReplyProcessMessages(IceConn iceConn, IcePointer clientData, int opcode,
ForwardRequest (pmConn, serviceName, serverAddress, hostAddress,
startOptions, authLen, authName, authData);
- if (serviceName)
- free (serviceName);
- if (serverAddress)
- free (serverAddress);
- if (hostAddress)
- free (hostAddress);
- if (startOptions)
- free (startOptions);
- if (authName)
- free (authName);
- if (authData)
- free (authData);
+ free (serviceName);
+ free (serverAddress);
+ free (hostAddress);
+ free (startOptions);
+ free (authName);
+ free (authData);
break;
}
@@ -793,10 +787,8 @@ PMReplyProcessMessages(IceConn iceConn, IcePointer clientData, int opcode,
}
}
- if (startCommand)
- free (startCommand);
- if (proxyAddress)
- free (proxyAddress);
+ free (startCommand);
+ free (proxyAddress);
PopRequestorQueue (pmConn, False,
runningProxy ? False : True /* free proxy list */);
@@ -836,10 +828,8 @@ PMReplyProcessMessages(IceConn iceConn, IcePointer clientData, int opcode,
}
}
- if (addr)
- free (addr);
- if (error)
- free (error);
+ free (addr);
+ free (error);
break;
}
@@ -976,10 +966,8 @@ ForwardRequest(PMconn *requestor, char *serviceName, char *serverAddress,
}
}
- if (startCommand)
- free (startCommand);
- if (proxyAddress)
- free (proxyAddress);
+ free (startCommand);
+ free (proxyAddress);
}
}
diff --git a/pmdb.c b/pmdb.c
index 9de3fb2..df8844f 100644
--- a/pmdb.c
+++ b/pmdb.c
@@ -372,20 +372,13 @@ ProxyGone (
req->authLen, req->authName,
req->authData);
}
- if (req->serviceName)
- free (req->serviceName);
- if (req->serverAddress)
- free (req->serverAddress);
- if (req->hostAddress)
- free (req->hostAddress);
- if (req->startOptions)
- free (req->startOptions);
- if (req->listData)
- free (req->listData); /* proxyList */
- if (req->authName)
- free (req->authName);
- if (req->authData)
- free (req->authData);
+ free (req->serviceName);
+ free (req->serverAddress);
+ free (req->hostAddress);
+ free (req->startOptions);
+ free (req->listData); /* proxyList */
+ free (req->authName);
+ free (req->authData);
free (req);
req = nextreq;
}
@@ -418,20 +411,13 @@ ProxyGone (
*prev_reqP = req->next;
- if (req->serviceName)
- free (req->serviceName);
- if (req->serverAddress)
- free (req->serverAddress);
- if (req->hostAddress)
- free (req->hostAddress);
- if (req->startOptions)
- free (req->startOptions);
- if (req->listData)
- free (req->listData); /* proxyList */
- if (req->authName)
- free (req->authName);
- if (req->authData)
- free (req->authData);
+ free (req->serviceName);
+ free (req->serverAddress);
+ free (req->hostAddress);
+ free (req->startOptions);
+ free (req->listData); /* proxyList */
+ free (req->authName);
+ free (req->authData);
free (req);
/* return; */ /* should but only one req, but... */
@@ -578,18 +564,12 @@ PushRequestorQueue (
!newreq->startOptions ||
(authLen > 0 && (!newreq->authName || !newreq->authData)))
{
- if (newreq->serviceName)
- free (newreq->serviceName);
- if (newreq->serverAddress)
- free (newreq->serverAddress);
- if (newreq->hostAddress)
- free (newreq->hostAddress);
- if (newreq->startOptions)
- free (newreq->startOptions);
- if (newreq->authName)
- free (newreq->authName);
- if (newreq->authData)
- free (newreq->authData);
+ free (newreq->serviceName);
+ free (newreq->serverAddress);
+ free (newreq->hostAddress);
+ free (newreq->startOptions);
+ free (newreq->authName);
+ free (newreq->authData);
free (newreq);
return 0;
}
@@ -730,18 +710,12 @@ PopRequestorQueue (
if (!newServer)
free (proxy->requests->serverAddress);
- if (proxy->requests->serviceName)
- free (proxy->requests->serviceName);
- if (proxy->requests->hostAddress)
- free (proxy->requests->hostAddress);
- if (proxy->requests->startOptions)
- free (proxy->requests->startOptions);
- if (freeProxyList && proxy->requests->listData)
- free (proxy->requests->listData); /* proxyList */
- if (proxy->requests->authName)
- free (proxy->requests->authName);
- if (proxy->requests->authData)
- free (proxy->requests->authData);
+ free (proxy->requests->serviceName);
+ free (proxy->requests->hostAddress);
+ free (proxy->requests->startOptions);
+ free (proxy->requests->listData); /* proxyList */
+ free (proxy->requests->authName);
+ free (proxy->requests->authData);
requestor = proxy->requests->requestor;