]> granicus.if.org Git - libevent/commitdiff
Remove spurious checks in evrpc.c error cases (coverity)
authorNick Mathewson <nickm@torproject.org>
Wed, 8 Jan 2014 17:04:06 +0000 (12:04 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 8 Jan 2014 17:04:06 +0000 (12:04 -0500)
Coverity hates the case where you have a redundant NULL check after
using something.

evrpc.c

diff --git a/evrpc.c b/evrpc.c
index 8d8ecc5aa87d5a1ac97b663745ed13ce391cd013..83230d4c7160d486e89b31744c3ea3aa17a8a23a 100644 (file)
--- a/evrpc.c
+++ b/evrpc.c
@@ -329,8 +329,7 @@ evrpc_request_cb(struct evhttp_request *req, void *arg)
        return;
 
 error:
-       if (rpc_state != NULL)
-               evrpc_reqstate_free_(rpc_state);
+       evrpc_reqstate_free_(rpc_state);
        evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
        return;
 }
@@ -372,8 +371,7 @@ evrpc_request_cb_closure(void *arg, enum EVRPC_HOOK_RESULT hook_res)
        return;
 
 error:
-       if (rpc_state != NULL)
-               evrpc_reqstate_free_(rpc_state);
+       evrpc_reqstate_free_(rpc_state);
        evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
        return;
 }
@@ -454,8 +452,7 @@ evrpc_request_done(struct evrpc_req_generic *rpc_state)
        return;
 
 error:
-       if (rpc_state != NULL)
-               evrpc_reqstate_free_(rpc_state);
+       evrpc_reqstate_free_(rpc_state);
        evhttp_send_error(req, HTTP_SERVUNAVAIL, NULL);
        return;
 }