This is an automated email from the ASF dual-hosted git repository.

chug pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
     new 2b34a16  DISPATCH-2199: Container link handlers to use qd_alloc 
safe_ptr functions
2b34a16 is described below

commit 2b34a1687911d89225d87a63786862dac9f57992
Author: Chuck Rolke <c...@apache.org>
AuthorDate: Fri Jul 16 16:41:31 2021 -0400

    DISPATCH-2199: Container link handlers to use qd_alloc safe_ptr functions
    
     * use qd_alloc_deref_safe_ptr in cleanup_link
     * use qd_alloc_set_safe_ptr   in qd_link_set_incoming_msg
    
    This closes #1300
---
 src/container.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/container.c b/src/container.c
index b3fa7d4..dc154eb 100644
--- a/src/container.c
+++ b/src/container.c
@@ -355,9 +355,10 @@ static void cleanup_link(qd_link_t *link)
         link->pn_sess = 0;
 
         // cleanup any inbound message that has not been forwarded
-        qd_message_t *msg = link->incoming_msg.ptr;
-        if (msg && qd_alloc_sequence(msg) == link->incoming_msg.seq)
+        qd_message_t *msg = qd_alloc_deref_safe_ptr(&link->incoming_msg);
+        if (msg) {
             qd_message_free(msg);
+        }
     }
 }
 
@@ -1224,8 +1225,7 @@ void qd_session_cleanup(qd_connection_t *qd_conn)
 void qd_link_set_incoming_msg(qd_link_t *link, qd_message_t *msg)
 {
     if (msg) {
-        link->incoming_msg.ptr = (void*) msg;
-        link->incoming_msg.seq = qd_alloc_sequence(msg);
+        qd_alloc_set_safe_ptr(&link->incoming_msg, msg);
     } else {
         qd_nullify_safe_ptr(&link->incoming_msg);
     }

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

Reply via email to