فهرست منبع

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

(cherry picked from commit a2252afe90e0acd779e64c47eacc174b4bbdc41c)
Daniel-Constantin Mierla 11 سال پیش
والد
کامیت
bf78e8498a
1فایلهای تغییر یافته به همراه15 افزوده شده و 13 حذف شده
  1. 15 13
      modules/tm/uac.c

+ 15 - 13
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);
 			}