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
@@ -355,11 +355,12 @@ 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);
}
}
+}
static int close_handler(qd_container_t *container, pn_connection_t *conn, qd_connection_t* qd_conn)
{
@@ -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);
}
