diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-11-08 16:05:52 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2014-11-08 16:05:52 -0800 |
commit | be8a5fbefcd6d3bee5e55283e06e255003b376b4 (patch) | |
tree | 9b58ff3951141db45835557e8d709d9f90e83fde | |
parent | f391fa1f55436ec2e4f7de4c4734fcd89cdbe250 (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.c | 3 | ||||
-rw-r--r-- | main.c | 36 | ||||
-rw-r--r-- | pmdb.c | 78 |
3 files changed, 39 insertions, 78 deletions
@@ -182,8 +182,7 @@ GetConfig ( found = 1; } - if (buf) - free (buf); + free (buf); fclose (fp); return found; @@ -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); } } @@ -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; |