[sr-dev] git:5.1:3da0bcb4: tm: free new tm cell in case of error if it was not referenced
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jun 7 09:00:43 CEST 2018
Module: kamailio
Branch: 5.1
Commit: 3da0bcb4b4e27d115a2d6eb47cd0cebc33d34a61
URL: https://github.com/kamailio/kamailio/commit/3da0bcb4b4e27d115a2d6eb47cd0cebc33d34a61
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2018-06-07T08:59:39+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
(cherry picked from commit f94770840029c1c73ab129f4b71fcb0cf146d808)
---
Modified: src/modules/tm/uac.c
---
Diff: https://github.com/kamailio/kamailio/commit/3da0bcb4b4e27d115a2d6eb47cd0cebc33d34a61.diff
Patch: https://github.com/kamailio/kamailio/commit/3da0bcb4b4e27d115a2d6eb47cd0cebc33d34a61.patch
---
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;
}
More information about the sr-dev
mailing list