Clear both pn_link/qd_link context pointers on free
Fixes 'invalid read' valgrind error in system tests.
close_links() can traverses the pn_link_t chain twice, before zeroing the pointer
the second pass was using a dangling context pointer to a freed qd_link.
@@ -827,7 +827,10 @@ qd_link_t *qd_link(qd_node_t *node, qd_connection_t *conn, qd_direction_t dir, c
void qd_link_free(qd_link_t *link)
{
if (!link) return;
+ if (link->pn_link) {
+ pn_link_set_context(link->pn_link, 0);
link->pn_link = 0;
+ }
link->pn_sess = 0;
free_qd_link_t(link);
}
