Repository: qpid-dispatch
Updated Branches:
  refs/heads/1.2.x c47c78126 -> 47b68137c


DISPATCH-1058 - Memory leak fixes and other fixes found by Coverity

(cherry picked from commit 9a48334eb32c261b527db1920a574dc5998f27b6)


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

Branch: refs/heads/1.2.x
Commit: 47b68137ced137c9e64da753b7e2b5ea7cda3a1a
Parents: c47c781
Author: Ganesh Murthy <gmur...@redhat.com>
Authored: Fri Jun 29 11:58:57 2018 -0400
Committer: Ganesh Murthy <gmur...@redhat.com>
Committed: Fri Jun 29 13:35:17 2018 -0400

----------------------------------------------------------------------
 src/policy.c                | 6 ++++--
 src/router_core/forwarder.c | 4 +++-
 src/server.c                | 3 +--
 3 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/47b68137/src/policy.c
----------------------------------------------------------------------
diff --git a/src/policy.c b/src/policy.c
index a483fcd..21038d8 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -289,8 +289,10 @@ qd_parse_tree_t * qd_policy_parse_tree(const char 
*config_spec)
 
     // make a writable, disposable copy of the csv string
     char * dup = strdup(config_spec);
-    if (!dup)
+    if (!dup) {
+        qd_parse_tree_free(tree);
         return NULL;
+    }
     char * dupend = dup + strlen(dup);
 
     char * pch = dup;
@@ -385,7 +387,7 @@ bool qd_policy_open_lookup_user(
             if (result) {
                 char *res_string = py_obj_2_c_string(result);
                 const size_t res_len = res_string ? strlen(res_string) : 0;
-                if (res_len < name_buf_size) {
+                if (res_string && res_len < name_buf_size) {
                     strcpy(name_buf, res_string);
                 } else {
                     qd_log(policy->log_source, QD_LOG_ERROR,

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/47b68137/src/router_core/forwarder.c
----------------------------------------------------------------------
diff --git a/src/router_core/forwarder.c b/src/router_core/forwarder.c
index 7003788..2840725 100644
--- a/src/router_core/forwarder.c
+++ b/src/router_core/forwarder.c
@@ -196,7 +196,7 @@ void qdr_forward_deliver_CT(qdr_core_t *core, qdr_link_t 
*out_link, qdr_delivery
     // If the out_link has a connected link and if the out_link is an 
inter-router link, increment the global deliveries_transit
     // If the out_link is a route container link, add to the global 
deliveries_egress
     //
-    if (out_link && out_link->connected_link) {
+    if (out_link->connected_link) {
         if (out_link->conn->role == QDR_ROLE_INTER_ROUTER) {
             core->deliveries_transit++;
         }
@@ -807,6 +807,8 @@ bool qdr_forward_link_balanced_CT(qdr_core_t     *core,
         return true;
     }
 
+    free(insert);
+    free(strip);
     return false;
 }
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/47b68137/src/server.c
----------------------------------------------------------------------
diff --git a/src/server.c b/src/server.c
index f065be3..3ce3db8 100644
--- a/src/server.c
+++ b/src/server.c
@@ -918,11 +918,10 @@ static bool handle(qd_server_t *qd_server, pn_event_t *e) 
{
 
     case PN_TRANSPORT_ERROR:
         {
-            qd_increment_conn_index(ctx);
-
             pn_transport_t *transport = pn_event_transport(e);
             pn_condition_t* condition = transport ? 
pn_transport_condition(transport) : NULL;
             if (ctx && ctx->connector) { /* Outgoing connection */
+                qd_increment_conn_index(ctx);
                 const qd_server_config_t *config = &ctx->connector->config;
                 if (condition  && pn_condition_is_set(condition)) {
                     qd_log(qd_server->log_source, QD_LOG_INFO, "Connection to 
%s failed: %s %s", config->host_port,


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

Reply via email to