[Freeswitch-svn] [commit] r8513 - freeswitch/trunk/src/mod/formats/mod_local_stream
Freeswitch SVN
mikej at freeswitch.org
Wed May 21 18:12:42 EDT 2008
Author: mikej
Date: Wed May 21 18:12:41 2008
New Revision: 8513
Modified:
freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
Log:
don't leak on error conditions in mod_local_stream. Found by Klockwork (www.klocwork.com)
Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Wed May 21 18:12:41 2008
@@ -120,10 +120,9 @@
if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
- return NULL;
+ goto done;
}
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open directory: %s\n", source->location);
switch_yield(1000000);
while(RUNNING) {
@@ -181,11 +180,11 @@
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
- return NULL;
+ switch_dir_close(source->dir_handle);
+ source->dir_handle = NULL;
+ goto done;
}
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing [%s] rate: %dhz\n", fname, source->rate);
-
while (RUNNING) {
switch_core_timer_next(&timer);
olen = source->samples;
@@ -231,6 +230,9 @@
source->dir_handle = NULL;
}
+done:
+ switch_buffer_destroy(&audio_buffer);
+
if (fd > -1) {
close(fd);
}
More information about the Freeswitch-svn
mailing list