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-1097 - Added code to fix issues reported by Coverity. This closes #354.
Date Tue, 07 Aug 2018 15:19:28 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 83f5d524a -> e545dd9cc


DISPATCH-1097 - Added code to fix issues reported by Coverity. This closes #354.


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

Branch: refs/heads/master
Commit: e545dd9cc3c3bc967e04752b6c28414987a86e63
Parents: 83f5d52
Author: Ganesh Murthy <gmurthy@redhat.com>
Authored: Mon Aug 6 21:36:01 2018 -0400
Committer: Ganesh Murthy <gmurthy@redhat.com>
Committed: Tue Aug 7 11:16:58 2018 -0400

----------------------------------------------------------------------
 src/router_core/route_control.c       |  8 +++++++-
 src/router_core/router_core_private.h | 16 ++++++++++++++++
 src/router_core/terminus.c            | 15 ---------------
 src/router_node.c                     |  8 ++++++++
 src/server.c                          | 12 +++++++-----
 5 files changed, 38 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e545dd9c/src/router_core/route_control.c
----------------------------------------------------------------------
diff --git a/src/router_core/route_control.c b/src/router_core/route_control.c
index 0bb916e..4de2ba3 100644
--- a/src/router_core/route_control.c
+++ b/src/router_core/route_control.c
@@ -18,6 +18,7 @@
  */
 
 #include "route_control.h"
+#include "router_core_private.h"
 #include <inttypes.h>
 #include <stdio.h>
 #include <qpid/dispatch/iterator.h>
@@ -242,13 +243,18 @@ static void qdr_auto_link_activate_CT(qdr_core_t *core, qdr_auto_link_t
*al, qdr
         if (key || al->external_addr) {
             if (al->external_addr) {
                 qdr_terminus_set_address(term, al->external_addr);
-                al->internal_addr = &key[2];
+                if (key)
+                    al->internal_addr = &key[2];
             } else
                 qdr_terminus_set_address(term, &key[2]); // truncate the "Mp" annotation
(where p = phase)
             al->link = qdr_create_link_CT(core, conn, QD_LINK_ENDPOINT, al->dir, source,
target);
             al->link->auto_link = al;
             al->state = QDR_AUTO_LINK_STATE_ATTACHING;
         }
+        else {
+            free_qdr_terminus_t(source);
+            free_qdr_terminus_t(target);
+        }
     }
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e545dd9c/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 d493037..c82f3c8 100644
--- a/src/router_core/router_core_private.h
+++ b/src/router_core/router_core_private.h
@@ -749,6 +749,22 @@ struct qdr_core_t {
 
 };
 
+struct qdr_terminus_t {
+    qdr_field_t            *address;
+    pn_durability_t         durability;
+    pn_expiry_policy_t      expiry_policy;
+    pn_seconds_t            timeout;
+    bool                    dynamic;
+    bool                    coordinator;
+    pn_distribution_mode_t  distribution_mode;
+    pn_data_t              *properties;
+    pn_data_t              *filter;
+    pn_data_t              *outcomes;
+    pn_data_t              *capabilities;
+};
+
+ALLOC_DECLARE(qdr_terminus_t);
+
 void *router_core_thread(void *arg);
 uint64_t qdr_identifier(qdr_core_t* core);
 void qdr_management_agent_on_message(void *context, qd_message_t *msg, int link_id, int cost);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e545dd9c/src/router_core/terminus.c
----------------------------------------------------------------------
diff --git a/src/router_core/terminus.c b/src/router_core/terminus.c
index 30623d1..a717ae5 100644
--- a/src/router_core/terminus.c
+++ b/src/router_core/terminus.c
@@ -21,21 +21,6 @@
 #include <strings.h>
 #include <stdio.h>
 
-struct qdr_terminus_t {
-    qdr_field_t            *address;
-    pn_durability_t         durability;
-    pn_expiry_policy_t      expiry_policy;
-    pn_seconds_t            timeout;
-    bool                    dynamic;
-    bool                    coordinator;
-    pn_distribution_mode_t  distribution_mode;
-    pn_data_t              *properties;
-    pn_data_t              *filter;
-    pn_data_t              *outcomes;
-    pn_data_t              *capabilities;
-};
-
-ALLOC_DECLARE(qdr_terminus_t);
 ALLOC_DEFINE(qdr_terminus_t);
 
 const char* QDR_COORDINATOR_ADDRESS = "$coordinator";

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e545dd9c/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 8c97b8b..5285894 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -1067,6 +1067,14 @@ static void AMQP_opened_handler(qd_router_t *router, qd_connection_t
*conn, bool
                                         DEQ_INSERT_TAIL(conn->connector->conn_info_list,
item);
                                         qd_log(router->log_source, QD_LOG_DEBUG, "Added
%s as backup host", item->host_port);
                                     }
+                                    else {
+                                        free(item->scheme);
+                                        free(item->host);
+                                        free(item->port);
+                                        free(item->hostname);
+                                        free(item->host_port);
+                                        free(item);
+                                    }
 
                                 }
                                 else {

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/e545dd9c/src/server.c
----------------------------------------------------------------------
diff --git a/src/server.c b/src/server.c
index 827a3f6..ab9ca92 100644
--- a/src/server.c
+++ b/src/server.c
@@ -947,11 +947,6 @@ static bool handle(qd_server_t *qd_server, pn_event_t *e, pn_connection_t
*pn_co
     if (ctx)
         qd_container_handle_event(qd_server->container, e, pn_conn, ctx);
 
-    /* Free the connection after all other processing is complete */
-    if (ctx && pn_event_type(e) == PN_TRANSPORT_CLOSED) {
-        pn_connection_set_context(pn_conn, NULL);
-        qd_connection_free(ctx);
-    }
     return true;
 }
 
@@ -976,6 +971,13 @@ static void *thread_run(void *arg)
                 qd_conn = !!pn_conn ? (qd_connection_t*) pn_connection_get_context(pn_conn)
: 0;
 
             running = handle(qd_server, e, conn, qd_conn);
+
+            /* Free the connection after all other processing is complete */
+            if (qd_conn && pn_event_type(e) == PN_TRANSPORT_CLOSED) {
+                pn_connection_set_context(pn_conn, NULL);
+                qd_connection_free(qd_conn);
+                qd_conn = 0;
+            }
         }
 
         //


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


Mime
View raw message