qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject qpid-dispatch git commit: DISPATCH-1214 - Fix a set of valgrind issues. More to come
Date Fri, 14 Dec 2018 01:21:12 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 4edacb72c -> 09c59f23c


DISPATCH-1214 - Fix a set of valgrind issues. More to come


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

Branch: refs/heads/master
Commit: 09c59f23cbfd29f0d5a09ebe24b00f883d625ec0
Parents: 4edacb7
Author: Ganesh Murthy <gmurthy@redhat.com>
Authored: Thu Dec 13 16:11:04 2018 -0500
Committer: Ganesh Murthy <gmurthy@redhat.com>
Committed: Thu Dec 13 17:44:44 2018 -0500

----------------------------------------------------------------------
 src/container.c                                       | 14 +++++++++-----
 src/router_core/core_client_api.c                     |  3 +++
 .../modules/address_lookup_client/lookup_client.c     |  4 ++++
 .../address_lookup_server/address_lookup_server.c     |  2 +-
 .../modules/edge_addr_tracking/edge_addr_tracking.c   |  4 ++++
 src/router_core/modules/edge_router/addr_proxy.c      |  3 +++
 src/router_core/router_core.c                         | 13 +++++++++++++
 src/router_core/router_core_private.h                 |  1 +
 src/server.c                                          |  4 ++--
 9 files changed, 40 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/container.c
----------------------------------------------------------------------
diff --git a/src/container.c b/src/container.c
index ea7db15..c3a2361 100644
--- a/src/container.c
+++ b/src/container.c
@@ -395,18 +395,21 @@ static void add_link_to_free_list(qd_pn_free_link_session_list_t *free_link_sess
  * using links/sessions after they are freed. Investigate and simplify if
  * possible.
 */
-void qd_conn_event_batch_complete(qd_container_t *container, qd_connection_t *qd_conn)
+void qd_conn_event_batch_complete(qd_container_t *container, qd_connection_t *qd_conn, bool
conn_closed)
 {
     qd_pn_free_link_session_t *to_free = DEQ_HEAD(qd_conn->free_link_session_list);
 
     while(to_free) {
-        if (to_free->pn_link)
-            pn_link_free(to_free->pn_link);
-        if (to_free->pn_session)
-            pn_session_free(to_free->pn_session);
+        if (!conn_closed) {
+            if (to_free->pn_link)
+                pn_link_free(to_free->pn_link);
+            if (to_free->pn_session)
+                pn_session_free(to_free->pn_session);
+        }
         DEQ_REMOVE_HEAD(qd_conn->free_link_session_list);
         free_qd_pn_free_link_session_t(to_free);
         to_free = DEQ_HEAD(qd_conn->free_link_session_list);
+
     }
 }
 
@@ -448,6 +451,7 @@ void qd_container_handle_event(qd_container_t *container, pn_event_t *event,
         if (pn_connection_state(conn) == (PN_LOCAL_ACTIVE | PN_REMOTE_CLOSED)) {
             close_links(container, conn, false);
             pn_connection_close(conn);
+            qd_conn_event_batch_complete(container, qd_conn, true);
         }
         break;
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/core_client_api.c
----------------------------------------------------------------------
diff --git a/src/router_core/core_client_api.c b/src/router_core/core_client_api.c
index 45c7150..9ef1c4e 100644
--- a/src/router_core/core_client_api.c
+++ b/src/router_core/core_client_api.c
@@ -600,6 +600,8 @@ static void _sender_detached_CT(void *client_context,
 
         _state_updated_CT(client);
     }
+
+    qdr_error_free(error);
     client->sender = NULL;
 }
 
@@ -627,6 +629,7 @@ static void _receiver_detached_CT(void *client_context,
 
         _state_updated_CT(client);
     }
+    qdr_error_free(error);
     client->receiver = NULL;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/modules/address_lookup_client/lookup_client.c
----------------------------------------------------------------------
diff --git a/src/router_core/modules/address_lookup_client/lookup_client.c b/src/router_core/modules/address_lookup_client/lookup_client.c
index 5e6d4a7..b457304 100644
--- a/src/router_core/modules/address_lookup_client/lookup_client.c
+++ b/src/router_core/modules/address_lookup_client/lookup_client.c
@@ -630,6 +630,9 @@ static uint64_t on_reply(qdr_core_t    *core,
         qcm_addr_lookup_local_search(client, request);
     }
 
+    qd_iterator_free(body);
+    qd_iterator_free(app_properties);
+
     return 0;
 }
 
@@ -729,6 +732,7 @@ static void qcm_addr_lookup_client_init_CT(qdr_core_t *core, void **module_conte
 static void qcm_addr_lookup_client_final_CT(void *module_context)
 {
     qcm_lookup_client_t *client = (qcm_lookup_client_t*) module_context;
+    qdrc_event_unsubscribe_CT(client->core, client->event_sub);
     client->core->addr_lookup_handler = 0;
     free(client);
 }

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/modules/address_lookup_server/address_lookup_server.c
----------------------------------------------------------------------
diff --git a/src/router_core/modules/address_lookup_server/address_lookup_server.c b/src/router_core/modules/address_lookup_server/address_lookup_server.c
index 194dba2..cde606f 100644
--- a/src/router_core/modules/address_lookup_server/address_lookup_server.c
+++ b/src/router_core/modules/address_lookup_server/address_lookup_server.c
@@ -309,9 +309,9 @@ static void _on_first_detach(void *link_context,
     qd_log(_server_state.core->log, QD_LOG_TRACE,
            "Client detached from address lookup server (container=%s, endpoint=%p)",
            epr->container_id, (void *)epr->endpoint);
-
     qdrc_endpoint_detach_CT(_server_state.core, epr->endpoint, 0);
     DEQ_REMOVE(_server_state.endpoints, epr);
+    qdr_error_free(error);
     free__endpoint_ref_t(epr);
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
----------------------------------------------------------------------
diff --git a/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c b/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
index 715be0b..50e994a 100644
--- a/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
+++ b/src/router_core/modules/edge_addr_tracking/edge_addr_tracking.c
@@ -70,6 +70,9 @@ static qd_message_t *qdcm_edge_create_address_dlv(qdr_core_t *core, qdr_address_
     // Finally, compose and retuen the message so it can be sent out.
     qd_message_compose_3(msg, fld, body);
 
+    qd_compose_free(body);
+    qd_compose_free(fld);
+
     return msg;
 }
 
@@ -130,6 +133,7 @@ static void qdrc_address_endpoint_on_first_detach(void *link_context,
     qdr_addr_tracking_module_context_t *mc = endpoint_state->mc;
     DEQ_REMOVE(mc->endpoint_state_list, endpoint_state);
     free_qdr_addr_endpoint_state_t(endpoint_state);
+    qdr_error_free(error);
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/modules/edge_router/addr_proxy.c
----------------------------------------------------------------------
diff --git a/src/router_core/modules/edge_router/addr_proxy.c b/src/router_core/modules/edge_router/addr_proxy.c
index 424bd35..a6c409e 100644
--- a/src/router_core/modules/edge_router/addr_proxy.c
+++ b/src/router_core/modules/edge_router/addr_proxy.c
@@ -343,6 +343,9 @@ static void on_second_attach(void           *link_context,
     qcm_edge_addr_proxy_t *ap = (qcm_edge_addr_proxy_t*) link_context;
 
     qdrc_endpoint_flow_CT(ap->core, ap->tracking_endpoint, INITIAL_CREDIT, false);
+
+    qdr_terminus_free(remote_source);
+    qdr_terminus_free(remote_target);
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/router_core.c
----------------------------------------------------------------------
diff --git a/src/router_core/router_core.c b/src/router_core/router_core.c
index e1225f8..3f21290 100644
--- a/src/router_core/router_core.c
+++ b/src/router_core/router_core.c
@@ -135,6 +135,12 @@ void qdr_core_free(qdr_core_t *core)
         qdr_core_delete_link_route(core, link_route);
     }
 
+    qdr_auto_link_t *auto_link = 0;
+    while ( (auto_link = DEQ_HEAD(core->auto_links))) {
+        DEQ_REMOVE_HEAD(core->auto_links);
+        qdr_core_delete_auto_link(core, auto_link);
+    }
+
     qdr_exchange_free_all(core);
 
     qdr_address_t *addr = 0;
@@ -398,6 +404,13 @@ void qdr_core_delete_link_route(qdr_core_t *core, qdr_link_route_t *lr)
     free_qdr_link_route_t(lr);
 }
 
+void qdr_core_delete_auto_link(qdr_core_t *core, qdr_auto_link_t *al)
+{
+    free(al->name);
+    free(al->external_addr);
+    free_qdr_auto_link_t(al);
+}
+
 static void free_address_config(qdr_address_config_t *addr)
 {
     free(addr->name);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/router_core/router_core_private.h
----------------------------------------------------------------------
diff --git a/src/router_core/router_core_private.h b/src/router_core/router_core_private.h
index 63fd5df..289614a 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -656,6 +656,7 @@ struct qdr_link_route_t {
 
 ALLOC_DECLARE(qdr_link_route_t);
 void qdr_core_delete_link_route(qdr_core_t *core, qdr_link_route_t *lr);
+void qdr_core_delete_auto_link (qdr_core_t *core,  qdr_auto_link_t *al);
 
 // Core timer related field/data structures
 typedef void (*qdr_timer_cb_t)(qdr_core_t *core, void* context);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/09c59f23/src/server.c
----------------------------------------------------------------------
diff --git a/src/server.c b/src/server.c
index 5ad6b50..24add4e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -731,7 +731,7 @@ static void invoke_deferred_calls(qd_connection_t *conn, bool discard)
 }
 
 void qd_container_handle_event(qd_container_t *container, pn_event_t *event, pn_connection_t
*pn_conn, qd_connection_t *qd_conn);
-void qd_conn_event_batch_complete(qd_container_t *container, qd_connection_t *qd_conn);
+void qd_conn_event_batch_complete(qd_container_t *container, qd_connection_t *qd_conn, bool
conn_closed);
 
 static void handle_listener(pn_event_t *e, qd_server_t *qd_server) {
     qd_log_source_t *log = qd_server->log_source;
@@ -1022,7 +1022,7 @@ static void *thread_run(void *arg)
         // processing.
         //
         if (qd_conn)
-            qd_conn_event_batch_complete(qd_server->container, qd_conn);
+            qd_conn_event_batch_complete(qd_server->container, qd_conn, false);
 
         pn_proactor_done(qd_server->proactor, events);
     }


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


Mime
View raw message