* nua_session.c: fixed client request reference counting in nua_session_usage_remove()
Bug reported by Della Betta Filippo.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9504
d0543943-73ff-0310-b7d9-
9358b9ac24b2
-Wed Sep 10 12:19:39 EDT 2008
+Wed Sep 10 12:19:57 EDT 2008
if (cr == cr0)
continue;
+ nua_client_request_ref(cr);
+
if (nua_invite_client_should_ack(cr)) {
ss->ss_reporting = 1;
nua_invite_client_ack(cr, NULL);
ss->ss_reporting = 0;
- nua_client_request_clean(cr);
}
if (cr == du->du_cr && cr->cr_orq)
nua_client_request_remove(cr);
+ nua_client_request_unref(cr);
+
cr_next = ds->ds_cr;
}
int
nua_client_request_remove(nua_client_request_t *cr)
{
- if (cr->cr_prev)
+ int retval = 0;
+ int in_queue = cr->cr_prev != NULL;
+
+ if (in_queue) {
if ((*cr->cr_prev = cr->cr_next))
cr->cr_next->cr_prev = cr->cr_prev;
+ }
cr->cr_prev = NULL, cr->cr_next = NULL;
if (cr->cr_timer) {
su_timer_destroy(cr->cr_timer), cr->cr_timer = NULL;
- nua_client_request_unref(cr);
+ retval = nua_client_request_unref(cr);
}
+ if (!in_queue)
+ return retval;
+
return nua_client_request_unref(cr);
}