qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [1/4] qpid-proton git commit: PROTON-1460: fix epoll proactor leak - missing freeaddrinfo()
Date Mon, 08 May 2017 19:03:58 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master e1d1f2f40 -> e28859b9a


PROTON-1460: fix epoll proactor leak - missing freeaddrinfo()


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c8ec3bb8
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c8ec3bb8
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c8ec3bb8

Branch: refs/heads/master
Commit: c8ec3bb84e35aa6713c3041b31bae702289a0baa
Parents: e1d1f2f
Author: Alan Conway <aconway@redhat.com>
Authored: Mon May 8 10:08:05 2017 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Mon May 8 10:08:32 2017 -0400

----------------------------------------------------------------------
 proton-c/src/proactor/epoll.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c8ec3bb8/proton-c/src/proactor/epoll.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proactor/epoll.c b/proton-c/src/proactor/epoll.c
index 22a6d92..42682e3 100644
--- a/proton-c/src/proactor/epoll.c
+++ b/proton-c/src/proactor/epoll.c
@@ -612,6 +612,9 @@ static inline bool pconnection_is_final(pconnection_t *pc) {
 }
 
 static void pconnection_final_free(pconnection_t *pc) {
+  if (pc->addrinfo) {
+    freeaddrinfo(pc->addrinfo);
+  }
   pn_incref(pc);                /* Make sure we don't do a circular free */
   pn_connection_driver_destroy(&pc->driver);
   pn_decref(pc);
@@ -988,8 +991,8 @@ void pconnection_connected_lh(pconnection_t *pc) {
     pc->connected = true;
     if (pc->addrinfo) {
       freeaddrinfo(pc->addrinfo);
+      pc->addrinfo = NULL;
     }
-    pc->addrinfo = NULL;
     pc->ai = NULL;
   }
 }
@@ -1031,6 +1034,8 @@ static void pconnection_maybe_connect_lh(pconnection_t *pc) {
       }
       /* connect failed immediately, go round the loop to try the next addr */
     }
+    freeaddrinfo(pc->addrinfo);
+    pc->addrinfo = NULL;
     /* If there was a previous attempted connection, let the poller discover the
        errno from its socket, otherwise set the current error. */
     if (pc->psocket.sockfd < 1) {
@@ -1177,7 +1182,9 @@ void pn_proactor_listen(pn_proactor_t *p, pn_listener_t *l, const char
*addr, in
       }
     }
   }
-  if (addrinfo) freeaddrinfo(addrinfo);
+  if (addrinfo) {
+    freeaddrinfo(addrinfo);
+  }
   /* Always put an OPEN event for symmetry, even if we immediately close with err */
   pn_collector_put(l->collector, pn_listener__class(), l, PN_LISTENER_OPEN);
   bool notify = wake(&l->context);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message