[Asterisk-cvs] asterisk/channels chan_h323.c,1.68,1.69

jeremy at lists.digium.com jeremy at lists.digium.com
Tue Jul 20 17:18:16 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv19702

Modified Files:
	chan_h323.c 
Log Message:
first attempt to properly copy and then free call detail strings.

Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- chan_h323.c	17 Jul 2004 19:38:30 -0000	1.68
+++ chan_h323.c	20 Jul 2004 21:04:16 -0000	1.69
@@ -1054,12 +1054,12 @@
 	}
 
 	/* Populate the call details in the private structure */
-	p->cd.call_token = cd.call_token;
-	p->cd.call_source_aliases = cd.call_source_aliases;
-	p->cd.call_dest_alias = cd.call_dest_alias;
-	p->cd.call_source_name = cd.call_source_name;
-	p->cd.call_source_e164 = cd.call_source_e164;
-	p->cd.call_dest_e164 = cd.call_dest_e164;
+	p->cd.call_token = strdup(cd.call_token);
+	p->cd.call_source_aliases = strdup(cd.call_source_aliases);
+	p->cd.call_dest_alias = strdup(cd.call_dest_alias);
+	p->cd.call_source_name = strdup(cd.call_source_name);
+	p->cd.call_source_e164 = strdup(cd.call_source_e164);
+	p->cd.call_dest_e164 = strdup(cd.call_dest_e164);
 
 	if (h323debug) {
 		ast_verbose(VERBOSE_PREFIX_3 "Setting up Call\n");
@@ -1291,6 +1291,32 @@
         return;
 }
 
+
+void cleanup_call_details(call_details_t cd) 
+{
+        if (cd.call_token) {
+                free((const char*)cd.call_token);
+        }
+        if (cd.call_source_aliases) {
+                free((const char*)cd.call_source_aliases);
+        }
+        if (cd.call_dest_alias) {
+                free((const char*)cd.call_dest_alias);
+	}
+        if (cd.call_source_name) { 
+                free((const char*)cd.call_source_name);
+        }
+        if (cd.call_source_e164) {
+                free((const char*)cd.call_source_e164);
+        }
+        if (cd.call_dest_e164) {
+                free((const char*)cd.call_dest_e164);
+        }
+        if (cd.sourceIp) {
+                free((const char*)cd.sourceIp);
+        }
+}
+
 /**
   * Call-back function to cleanup communication
   * Returns nothing,
@@ -1335,6 +1361,8 @@
 		ast_rtp_destroy(rtp);
 	}
 
+	cleanup_call_details(p->cd);
+	
 	p->alreadygone = 1;
 	
 	/* Send hangup */	




More information about the svn-commits mailing list