[sr-dev] git:master:72234f9e: pv_headers: use t_unset() based on vref instead of resetting global t always

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 30 10:59:50 CEST 2022


Module: kamailio
Branch: master
Commit: 72234f9efbb5b299823b33dc4eda84a43d5f6384
URL: https://github.com/kamailio/kamailio/commit/72234f9efbb5b299823b33dc4eda84a43d5f6384

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-08-30T10:58:39+02:00

pv_headers: use t_unset() based on vref instead of resetting global t always

---

Modified: src/modules/pv_headers/pv_headers.c

---

Diff:  https://github.com/kamailio/kamailio/commit/72234f9efbb5b299823b33dc4eda84a43d5f6384.diff
Patch: https://github.com/kamailio/kamailio/commit/72234f9efbb5b299823b33dc4eda84a43d5f6384.patch

---

diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
index 7da426c184..b900ae5be6 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -555,12 +555,12 @@ int handle_msg_reply_cb(struct sip_msg *msg, unsigned int flags, void *cb)
 		xavi_set_list(backup_xavis);
 		LM_DBG("restored backup_xavis:%p\n", *backup_xavis);
 	}
-	if(t && vref) {
-		tmb.unref_cell(t);
+	if(t != NULL && t != T_UNDEFINED && vref != 0) {
+		/*  t_find() above has the side effect of setting T and
+			REFerencing T => we must unref and unset it */
+		tmb.t_unset();
 		LM_DBG("T:%p unref\n", t);
 	}
-	tmb.t_sett(T_UNDEFINED, T_BR_UNDEFINED);
-	LM_DBG("reset tm\n");
 
 	return 1;
 }




More information about the sr-dev mailing list