[Freeswitch-svn] [commit] r8875 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Tue Jul 1 13:45:35 EDT 2008


Author: mikej
Date: Tue Jul  1 13:45:35 2008
New Revision: 8875

Modified:
   freeswitch/trunk/src/switch_ivr_async.c

Log:
don't destroy a codec that has not been created (MODAPP-101)

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Tue Jul  1 13:45:35 2008
@@ -495,6 +495,7 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+	int codec_initialized = 0;
 
 	if ((tsession = switch_core_session_locate(uuid))) {
 		struct eavesdrop_pvt *ep = NULL;
@@ -554,6 +555,8 @@
 			goto end;
 		}
 
+		codec_initialized = 1;
+
 		switch_core_session_set_read_codec(session, &codec);
 		write_frame.codec = &codec;
 		write_frame.data = buf;
@@ -683,8 +686,8 @@
 		}
 
 	  end:
-
-		switch_core_codec_destroy(&codec);
+		if ( codec_initialized )
+			switch_core_codec_destroy(&codec);
 
 		if (bug) {
 			switch_core_media_bug_remove(tsession, &bug);



More information about the Freeswitch-svn mailing list