瀏覽代碼

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)
(cherry picked from commit bf78e8498a9ac9441fcdb7141b0cf2a7b8739e83)
(cherry picked from commit afd309b42e37e07e6f467dff47dde00e8e8fb407)
Daniel-Constantin Mierla 11 年之前
父節點
當前提交
948dd5913a
共有 1 個文件被更改,包括 15 次插入13 次删除
  1. 15 13
      modules/tm/uac.c

+ 15 - 13
modules/tm/uac.c

@@ -394,19 +394,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,
@@ -458,6 +446,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);
 			}