[Freeswitch-svn] [commit] r3204 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN mikej at freeswitch.org
Wed Oct 25 14:00:14 EDT 2006


Author: mikej
Date: Wed Oct 25 14:00:14 2006
New Revision: 3204

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
why malloc?

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Wed Oct 25 14:00:14 2006
@@ -3626,7 +3626,7 @@
 	if(signal_ptr) {
 		struct private_object *tech_pvt = NULL;
 		switch_channel_t *channel = NULL;
-		char *dtmf_digit;
+		char dtmf_digit[2] = {0,0};
 
 		//Get the channel
 		channel = switch_core_session_get_channel(session);
@@ -3640,26 +3640,18 @@
 		//Barf if we didn't get it
 		assert(tech_pvt != NULL);
 
-		//holder for the dtmf digit
-		dtmf_digit = malloc(sizeof(char) * 2);
-
 		//move signal_ptr where we need it (right past Signal=)
 		signal_ptr = signal_ptr + 7;
 
 		//put the digit somewhere we can muck with
 		strncpy(dtmf_digit, signal_ptr, 1);
 
-		//End the string
-		*(dtmf_digit + 1) = '\0';
-
 		//queue it up
 		switch_channel_queue_dtmf(channel, dtmf_digit);
 		
 		//print debug info
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INFO DTMF(%s)\n", dtmf_digit);
 
-		//Give back the memory I borrowed
-		free(dtmf_digit);
 	} else { //unknown info type
 		sip_from_t const *from;
 



More information about the Freeswitch-svn mailing list