[sr-dev] git:master: tm: do all the clean local msg structure in one place

Daniel-Constantin Mierla miconda at gmail.com
Fri Oct 31 10:50:14 CET 2014


Module: sip-router
Branch: master
Commit: a2252afe90e0acd779e64c47eacc174b4bbdc41c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a2252afe90e0acd779e64c47eacc174b4bbdc41c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Oct 31 00:31:11 2014 +0100

tm: do all the clean local msg structure in one place

- uri/dst-uri were clened before the entire local sip message, not being
  visible while rebuilding the content

---

 modules/tm/uac.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/modules/tm/uac.c b/modules/tm/uac.c
index 9a9cf48..0398118 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -395,19 +395,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 				tm_xdata_swap(new_cell, &backup_xd, 1);
 				setsflagsval(sflag_bk);
 
-				if (unlikely(lreq.new_uri.s))
-				{
-					pkg_free(lreq.new_uri.s);
-					lreq.new_uri.s=0;
-					lreq.new_uri.len=0;
-				}
-				if (unlikely(lreq.dst_uri.s))
-				{
-					pkg_free(lreq.dst_uri.s);
-					lreq.dst_uri.s=0;
-					lreq.dst_uri.len=0;
-				}
-
+				/* rebuild the new message content */
 				if(lreq.force_send_socket != uac_r->dialog->send_sock) {
 					LM_DBG("Send socket updated to: %.*s",
 							lreq.force_send_socket->address_str.len,
@@ -459,6 +447,20 @@ normal_update:
 						}
 					}
 				}
+
+				/* clean local msg structure */
+				if (unlikely(lreq.new_uri.s))
+				{
+					pkg_free(lreq.new_uri.s);
+					lreq.new_uri.s=0;
+					lreq.new_uri.len=0;
+				}
+				if (unlikely(lreq.dst_uri.s))
+				{
+					pkg_free(lreq.dst_uri.s);
+					lreq.dst_uri.s=0;
+					lreq.dst_uri.len=0;
+				}
 				lreq.buf=0; /* covers the obsolete DYN_BUF */
 				free_sip_msg(&lreq);
 			}




More information about the sr-dev mailing list