]> granicus.if.org Git - libevent/commitdiff
Merge branch 'fix-uchex-warnings'
authorAzat Khuzhin <azat@libevent.org>
Sun, 31 Mar 2019 23:42:55 +0000 (02:42 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 25 May 2019 18:25:11 +0000 (21:25 +0300)
There is one more report that is false positive, see [1]:
  "In bufferevent_openssl.c, pointer wm is dereferenced on line 871
before it is null checked on line 873."

  [1]: https://github.com/libevent/libevent/issues/382#issuecomment-238081938

* fix-uchex-warnings:
  evdns: do not check server_req twice
  evrpc: do not check req twice

Fixes: #382
(cherry picked from commit da33f768e451f1b5722b7426e03c87e260ee43d0)

evdns.c
evrpc.c

diff --git a/evdns.c b/evdns.c
index 3cf6ef0955a87fbfa26de7434b35cd8e933f3201..db25ad54a3f08eab4244abf12ab10471e4d0639c 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -1299,14 +1299,12 @@ request_parse(u8 *packet, int length, struct evdns_server_port *port, struct soc
 
        return 0;
 err:
-       if (server_req) {
-               if (server_req->base.questions) {
-                       for (i = 0; i < server_req->base.nquestions; ++i)
-                               mm_free(server_req->base.questions[i]);
-                       mm_free(server_req->base.questions);
-               }
-               mm_free(server_req);
+       if (server_req->base.questions) {
+               for (i = 0; i < server_req->base.nquestions; ++i)
+                       mm_free(server_req->base.questions[i]);
+               mm_free(server_req->base.questions);
        }
+       mm_free(server_req);
        return -1;
 
 #undef SKIP_NAME
diff --git a/evrpc.c b/evrpc.c
index 68fa1b90f3315cc95c6018171153cfc45a66e8fc..4a60ca5f0703fe551c4d1b6a8122370dea3d1b5a 100644 (file)
--- a/evrpc.c
+++ b/evrpc.c
@@ -892,8 +892,7 @@ evrpc_reply_done(struct evhttp_request *req, void *arg)
                         * layer is going to free it.  we need to
                         * request ownership explicitly
                         */
-                       if (req != NULL)
-                               evhttp_request_own(req);
+                       evhttp_request_own(req);
 
                        evrpc_pause_request(pool, ctx,
                            evrpc_reply_done_closure);