mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 20:48:21 +00:00
Memory leak at mod_local_stream (MODFORM-36)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15431 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b350fc9c0f
commit
52c381a1ea
@ -119,6 +119,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
switch_byte_t *dist_buf;
|
switch_byte_t *dist_buf;
|
||||||
switch_size_t used;
|
switch_size_t used;
|
||||||
int skip = 0;
|
int skip = 0;
|
||||||
|
switch_memory_pool_t *temp_pool = NULL;
|
||||||
|
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
THREADS++;
|
THREADS++;
|
||||||
@ -147,7 +148,16 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
while (RUNNING && !source->stopped) {
|
while (RUNNING && !source->stopped) {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
|
|
||||||
if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
|
if (temp_pool) {
|
||||||
|
switch_core_destroy_memory_pool(&temp_pool);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switch_core_new_memory_pool(&temp_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error creating pool");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (switch_dir_open(&source->dir_handle, source->location, temp_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -202,7 +212,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, temp_pool) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
|
||||||
switch_dir_close(source->dir_handle);
|
switch_dir_close(source->dir_handle);
|
||||||
source->dir_handle = NULL;
|
source->dir_handle = NULL;
|
||||||
@ -336,6 +346,10 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (temp_pool) {
|
||||||
|
switch_core_destroy_memory_pool(&temp_pool);
|
||||||
|
}
|
||||||
|
|
||||||
switch_core_destroy_memory_pool(&source->pool);
|
switch_core_destroy_memory_pool(&source->pool);
|
||||||
|
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user