From 0aa80482ada50ffd96c778db0b4ac6506712f0f5 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 15 Nov 2025 00:51:13 +0300 Subject: [PATCH] nta: Ensure forked transactions are removed from parent's fork list --- libsofia-sip-ua/nta/nta.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/libsofia-sip-ua/nta/nta.c b/libsofia-sip-ua/nta/nta.c index f63da1e96..cfa4cd933 100644 --- a/libsofia-sip-ua/nta/nta.c +++ b/libsofia-sip-ua/nta/nta.c @@ -8888,11 +8888,6 @@ outgoing_cut_off(nta_outgoing_t *orq) if (outgoing_is_queued(orq)) outgoing_remove(orq); -#if 0 - if (orq->orq_forked) - outgoing_remove_fork(orq); -#endif - outgoing_reset_timer(orq); if (orq->orq_pending) { @@ -8983,11 +8978,21 @@ void outgoing_destroy(nta_outgoing_t *orq) && !orq->orq_canceled /* or it has been forked */ && !orq->orq_forking && !orq->orq_forks) { + /* This transaction is not a fork */ orq->orq_destroyed = 1; outgoing_terminate(orq); return; } + if (orq->orq_forked) { + /* This transaction is a fork */ + outgoing_remove_fork(orq); + orq->orq_destroyed = 1; + outgoing_terminate(orq); + return; + } + + /* This transaction is not a fork */ orq->orq_destroyed = 1; orq->orq_callback = outgoing_default_cb; orq->orq_magic = NULL; @@ -9340,10 +9345,11 @@ outgoing_remove_fork(nta_outgoing_t *orq) orq->orq_forks = NULL; orq->orq_forking = NULL; orq->orq_forked = 0; + return; } } - assert(orq == NULL); + assert(orq->orq_forking == NULL); } /** Terminate a client transaction. */