summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-11-17 12:59:35 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-11-17 12:59:36 -0600
commite6ac74f0f76f1e0525a4db2bd00c24002528792a (patch)
tree45fabb63154378c58ce1e4423cb79d5d7f2ab6d9
parente18b07da9d9b13a21eb93dfbbebfc0b2b18128d1 (diff)
parenta83e426e9105882e03f2d84a7ff03436bd76b235 (diff)
Merge "res/res_pjsip: Fix off nominal crash with requests that fail and have a timer"
-rw-r--r--res/res_pjsip.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 9d0540d42..a4748d20e 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -3151,9 +3151,11 @@ static pj_status_t endpt_send_request(struct ast_sip_endpoint *endpoint,
char errmsg[PJ_ERR_MSG_SIZE];
if (timeout > 0) {
- pj_timer_heap_cancel_if_active(pjsip_endpt_get_timer_heap(endpt),
+ int timers_cancelled = pj_timer_heap_cancel_if_active(pjsip_endpt_get_timer_heap(endpt),
req_wrapper->timeout_timer, TIMER_INACTIVE);
- ao2_ref(req_wrapper, -1);
+ if (timers_cancelled > 0) {
+ ao2_ref(req_wrapper, -1);
+ }
}
/* Complain of failure to send the request. */