DISPATCH-847 - Fixed Coverity issue 181417 (Use after free)
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/d0dcac4d Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/d0dcac4d Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/d0dcac4d Branch: refs/heads/master Commit: d0dcac4d9dd76f959b74fb8b17d4cef54bb2f1d5 Parents: 9556f58 Author: Ted Ross <tr...@redhat.com> Authored: Wed Oct 4 09:50:57 2017 -0400 Committer: Ted Ross <tr...@redhat.com> Committed: Wed Oct 4 09:50:57 2017 -0400 ---------------------------------------------------------------------- src/router_core/transfer.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/d0dcac4d/src/router_core/transfer.c ---------------------------------------------------------------------- diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c index e4cbaae..373e439 100644 --- a/src/router_core/transfer.c +++ b/src/router_core/transfer.c @@ -576,19 +576,19 @@ void qdr_delivery_unlink_peers_CT(qdr_core_t *core, qdr_delivery_t *dlv, qdr_del // The dlv has more than one peer. We are going to find the peer of dlv that match with the passed in peer // and delete that peer. // - qdr_delivery_ref_t *dlv_ref = DEQ_HEAD(dlv->peers); - while (dlv_ref) { - qdr_delivery_t * peer_dlv = dlv_ref->dlv; + qdr_delivery_ref_t *peer_ref = DEQ_HEAD(dlv->peers); + while (peer_ref) { + qdr_delivery_t *peer_dlv = peer_ref->dlv; if (peer_dlv == peer) { - if (peer->peer) { + qdr_del_delivery_ref(&dlv->peers, peer_ref); + if (peer->peer == dlv) { peer->peer = 0; qdr_delivery_decref_CT(core, dlv); } - qdr_del_delivery_ref(&dlv->peers, dlv_ref); qdr_delivery_decref_CT(core, peer); break; } - dlv_ref = DEQ_NEXT(dlv_ref); + peer_ref = DEQ_NEXT(peer_ref); } } } @@ -606,13 +606,13 @@ qdr_delivery_t *qdr_delivery_first_peer_CT(qdr_delivery_t *dlv) } else { // The delivery has more than one peer. - qdr_delivery_ref_t *dlv_ref = DEQ_HEAD(dlv->peers); + qdr_delivery_ref_t *peer_ref = DEQ_HEAD(dlv->peers); // Save the next peer to dlv->next_peer_ref so we can use it when somebody calls qdr_delivery_next_peer_CT - dlv->next_peer_ref = DEQ_NEXT(dlv_ref); + dlv->next_peer_ref = DEQ_NEXT(peer_ref); // Return the first peer. - return dlv_ref->dlv; + return peer_ref->dlv; } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org