Module: kamailio Branch: master Commit: f94770840029c1c73ab129f4b71fcb0cf146d808 URL: https://github.com/kamailio/kamailio/commit/f94770840029c1c73ab129f4b71fcb0c...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-06-06T10:25:27+02:00
tm: free new tm cell in case of error if it was not referenced
- part of t_uac_prepare(), reported by GH #1554
---
Modified: src/modules/tm/uac.c
---
Diff: https://github.com/kamailio/kamailio/commit/f94770840029c1c73ab129f4b71fcb0c... Patch: https://github.com/kamailio/kamailio/commit/f94770840029c1c73ab129f4b71fcb0c...
---
diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c index ff466760dd..9b2f51b5f6 100644 --- a/src/modules/tm/uac.c +++ b/src/modules/tm/uac.c @@ -583,11 +583,18 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
error2: #ifdef TM_DEL_UNREF - if (!is_ack) { - UNREF_FREE(new_cell); - }else -#endif + if (is_ack) { free_cell(new_cell); + } else { + if(atomic_get_int(&new_cell->ref_count)==0) { + free_cell(new_cell); + } else { + UNREF_FREE(new_cell); + } + } +#else + free_cell(new_cell); +#endif error3: return ret; }