[sr-dev] git:master: pua(k): use dedicated function to free tm dlg

Daniel-Constantin Mierla miconda at gmail.com
Fri Dec 23 13:17:44 CET 2011


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Dec 23 13:16:46 2011 +0100

pua(k): use dedicated function to free tm dlg

---

 modules_k/pua/send_subscribe.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/modules_k/pua/send_subscribe.c b/modules_k/pua/send_subscribe.c
index 8d358a3..a3b647c 100644
--- a/modules_k/pua/send_subscribe.c
+++ b/modules_k/pua/send_subscribe.c
@@ -212,6 +212,20 @@ dlg_t* pua_build_dlg_t(ua_pres_t* presentity)
 	return td;
 }
 
+/**
+ * free the field in dlg_t as filled/allocated by this module
+ */
+static int pua_free_tm_dlg(dlg_t *td)
+{
+	if(td)
+	{
+		if(td->route_set)
+			free_rr(&td->route_set);
+		pkg_free(td);
+	}
+	return 0;
+}
+
 void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
 {
 	struct sip_msg* msg= NULL;
@@ -882,6 +896,10 @@ ua_pres_t* subs_cbparam_indlg(ua_pres_t* subs, int expires, int ua_flag)
 
 }	
 
+
+/**
+ *
+ */
 int send_subscribe(subs_info_t* subs)
 {
 	ua_pres_t* presentity= NULL;
@@ -1174,12 +1192,7 @@ insert:
 
 
 done:
-	if(td!=NULL) {
-		if(td->route_set)
-			free_rr(&td->route_set);
-		pkg_free(td);
-		td= NULL;
-	}
+	pua_free_tm_dlg(td);
 	pkg_free(str_hdr);
 	free_results_puadb(res);
 	return ret;




More information about the sr-dev mailing list