qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1691209 - /qpid/dispatch/trunk/src/container.c
Date Wed, 15 Jul 2015 13:41:27 GMT
Author: tross
Date: Wed Jul 15 13:41:27 2015
New Revision: 1691209

URL: http://svn.apache.org/r1691209
Log:
DISPATCH-149 - Fixed a regression introduced in the first commit for this Jira.
    In the case of connection-loss during link-routing, a pn_link_t was being double-freed.

Modified:
    qpid/dispatch/trunk/src/container.c

Modified: qpid/dispatch/trunk/src/container.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/container.c?rev=1691209&r1=1691208&r2=1691209&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/container.c (original)
+++ qpid/dispatch/trunk/src/container.c Wed Jul 15 13:41:27 2015
@@ -380,9 +380,16 @@ int pn_event_handler(void *handler_conte
             qd_detach_type_t dt = pn_event_type(event) == PN_LINK_REMOTE_CLOSE ? QD_CLOSED
: QD_DETACHED;
             if (node)
                 node->ntype->link_detach_handler(node->context, qd_link, dt);
+
+            //
+            // If the qd_link does not reference the pn_link, we have already freed the pn_link.
+            // If we attempt to free it again, proton will crash.
+            //
+            if (qd_link->pn_link == pn_link) {
+                pn_link_close(pn_link);
+                pn_link_free(pn_link);
+            }
         }
-        pn_link_close(pn_link);
-        pn_link_free(pn_link);
         break;
 
     case PN_LINK_FINAL :
@@ -712,6 +719,8 @@ void *qd_link_get_context(qd_link_t *lin
 
 void qd_link_set_conn_context(qd_link_t *link, void *context)
 {
+    if (!link || !link->pn_link)
+        return;
     pn_session_t *pn_sess = pn_link_session(link->pn_link);
     if (!pn_sess)
         return;
@@ -727,6 +736,8 @@ void qd_link_set_conn_context(qd_link_t
 
 void *qd_link_get_conn_context(qd_link_t *link)
 {
+    if (!link || !link->pn_link)
+        return 0;
     pn_session_t *pn_sess = pn_link_session(link->pn_link);
     if (!pn_sess)
         return 0;



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


Mime
View raw message