Repository: qpid-dispatch Updated Branches: refs/heads/master cc3ab6557 -> f87a33389
DISPATCH-1069: memory grows on a long-lived connection Fixed by removing the test `pn_link_get_context(link)` while handling PN_LINK_LOCAL_CLOSE. qd_link_free() can clear the pn_link context before the PN_LINK_LOCAL_CLOSE event is handled, in that case the link was never freed. The fix won't cause double-free. pn_link_free() is only called in 2 places, handling PN_LINK_LOCAL_CLOSE and PN_LINK_REMOTE_CLOSE. In both cases it is only called if the link is closed at both ends. It is not possible for both of these events to fire for the same link with both ends closed, the one that fires first will always have the other end open. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/f87a3338 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/f87a3338 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/f87a3338 Branch: refs/heads/master Commit: f87a33389b268ef5fe20a8b08179310f1c135d28 Parents: cc3ab65 Author: Alan Conway <acon...@redhat.com> Authored: Tue Jul 10 19:22:24 2018 -0400 Committer: Alan Conway <acon...@redhat.com> Committed: Tue Jul 10 19:45:35 2018 -0400 ---------------------------------------------------------------------- src/container.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f87a3338/src/container.c ---------------------------------------------------------------------- diff --git a/src/container.c b/src/container.c index a70e5a1..52231b4 100644 --- a/src/container.c +++ b/src/container.c @@ -530,7 +530,7 @@ void qd_container_handle_event(qd_container_t *container, pn_event_t *event) case PN_LINK_LOCAL_DETACH: case PN_LINK_LOCAL_CLOSE: pn_link = pn_event_link(event); - if (pn_link_state(pn_link) == (PN_LOCAL_CLOSED | PN_REMOTE_CLOSED) && pn_link_get_context(pn_link)) { + if (pn_link_state(pn_link) == (PN_LOCAL_CLOSED | PN_REMOTE_CLOSED)) { pn_link_set_context(pn_link, NULL); pn_link_free(pn_link); } @@ -791,7 +791,7 @@ void qd_link_free(qd_link_t *link) { if (!link) return; if (link->pn_link) { - pn_link_set_context(link->pn_link, 0); + pn_link_set_context(link->pn_link, NULL); link->pn_link = 0; } link->pn_sess = 0; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org