Module: kamailio
Branch: master
Commit: 7f072b018fee8607787bdef6d093e52990873c71
URL: 
https://github.com/kamailio/kamailio/commit/7f072b018fee8607787bdef6d093e52990873c71

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-05-02T21:36:20+02:00

tm: function to clean/reset local data

---

Modified: src/modules/tmx/t_var.c
Modified: src/modules/tmx/t_var.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/7f072b018fee8607787bdef6d093e52990873c71.diff
Patch: 
https://github.com/kamailio/kamailio/commit/7f072b018fee8607787bdef6d093e52990873c71.patch

---

diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c
index aa6833aad37..5320366aaeb 100644
--- a/src/modules/tmx/t_var.c
+++ b/src/modules/tmx/t_var.c
@@ -67,6 +67,34 @@ void pv_tmx_data_init(void)
        memset(&_pv_tinv, 0, sizeof(struct _pv_tmx_data));
 }
 
+void pv_tmx_data_free(void)
+{
+       if(_pv_treq.buf) {
+               if(_pv_treq.tmsgp)
+                       free_sip_msg(&_pv_treq.msg);
+               pkg_free(_pv_treq.buf);
+               _pv_treq.buf = NULL;
+               _pv_treq.buf_size = 0;
+               _pv_treq.tmsgp = NULL;
+       }
+       if(_pv_trpl.buf) {
+               if(_pv_trpl.tmsgp)
+                       free_sip_msg(&_pv_trpl.msg);
+               pkg_free(_pv_trpl.buf);
+               _pv_trpl.buf = NULL;
+               _pv_trpl.buf_size = 0;
+               _pv_trpl.tmsgp = NULL;
+       }
+       if(_pv_tinv.buf) {
+               if(_pv_tinv.tmsgp)
+                       free_sip_msg(&_pv_tinv.msg);
+               pkg_free(_pv_tinv.buf);
+               _pv_tinv.buf = NULL;
+               _pv_tinv.buf_size = 0;
+               _pv_tinv.tmsgp = NULL;
+       }
+}
+
 int pv_t_copy_msg(struct sip_msg *src, struct sip_msg *dst)
 {
        dst->id = src->id;
diff --git a/src/modules/tmx/t_var.h b/src/modules/tmx/t_var.h
index 0ecb6a60588..56b7d757bdc 100644
--- a/src/modules/tmx/t_var.h
+++ b/src/modules/tmx/t_var.h
@@ -30,6 +30,7 @@
 #include "../../core/pvar.h"
 
 void pv_tmx_data_init(void);
+void pv_tmx_data_free(void);
 
 int pv_get_t_var_inv(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);
 int pv_get_t_var_req(struct sip_msg *msg, pv_param_t *param, pv_value_t *res);

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to