[Freeswitch-svn] [commit] r13219 - freeswitch/trunk/src
FreeSWITCH SVN
anthm at freeswitch.org
Fri May 1 14:31:16 PDT 2009
Author: anthm
Date: Fri May 1 16:31:16 2009
New Revision: 13219
Log:
prevent buffer destroy race
Modified:
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_session.c
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Fri May 1 16:31:16 2009
@@ -915,6 +915,9 @@
} else {
switch_size_t x;
for (x = 0; x < frames; x++) {
+ if (switch_channel_down(session->channel) || !session->raw_write_buffer) {
+ goto error;
+ }
if ((session->raw_write_frame.datalen = (uint32_t)
switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes)) != 0) {
int rate;
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Fri May 1 16:31:16 2009
@@ -879,9 +879,15 @@
switch_mutex_unlock(session->resample_mutex);
/* clear indications */
switch_core_session_flush_message(session);
+
/* wipe these, they will be recreated if need be */
- switch_buffer_destroy(&session->raw_read_buffer);
+ switch_mutex_lock(session->codec_write_mutex);
switch_buffer_destroy(&session->raw_write_buffer);
+ switch_mutex_unlock(session->codec_write_mutex);
+
+ switch_mutex_lock(session->codec_read_mutex);
+ switch_buffer_destroy(&session->raw_read_buffer);
+ switch_mutex_unlock(session->codec_read_mutex);
if (flush_dtmf) {
while ((has = switch_channel_has_dtmf(channel))) {
More information about the Freeswitch-svn
mailing list