Fix memory leaks

(closes issue ASTERISK-22368)
Reported by: Corey Farrell
Patches:
     issueA22368_mixmonitor_free_filename.patch uploaded by wdoekes (license 5674)
........

Merged revisions 398004 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@398011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin Harwell
2013-08-30 16:20:21 +00:00
parent 3e0157c46f
commit 3eb037cbb5

View File

@@ -142,7 +142,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<variable name="MIXMONITOR_FILENAME"> <variable name="MIXMONITOR_FILENAME">
<para>Will contain the filename used to record.</para> <para>Will contain the filename used to record.</para>
</variable> </variable>
</variablelist> </variablelist>
</description> </description>
<see-also> <see-also>
<ref type="application">Monitor</ref> <ref type="application">Monitor</ref>
@@ -409,7 +409,7 @@ static void destroy_monitor_audiohook(struct mixmonitor *mixmonitor)
ast_audiohook_destroy(&mixmonitor->audiohook); ast_audiohook_destroy(&mixmonitor->audiohook);
} }
static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook) static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook)
{ {
struct ast_channel *peer = NULL; struct ast_channel *peer = NULL;
int res = 0; int res = 0;
@@ -420,7 +420,7 @@ static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook)
ast_audiohook_attach(chan, audiohook); ast_audiohook_attach(chan, audiohook);
if (!res && ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) if (!res && ast_test_flag(ast_channel_flags(chan), AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE); ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
return res; return res;
} }
@@ -497,13 +497,15 @@ static void mixmonitor_free(struct mixmonitor *mixmonitor)
if (mixmonitor->mixmonitor_ds) { if (mixmonitor->mixmonitor_ds) {
ast_mutex_destroy(&mixmonitor->mixmonitor_ds->lock); ast_mutex_destroy(&mixmonitor->mixmonitor_ds->lock);
ast_cond_destroy(&mixmonitor->mixmonitor_ds->destruction_condition); ast_cond_destroy(&mixmonitor->mixmonitor_ds->destruction_condition);
ast_free(mixmonitor->filename_write);
ast_free(mixmonitor->filename_read);
ast_free(mixmonitor->mixmonitor_ds); ast_free(mixmonitor->mixmonitor_ds);
ast_free(mixmonitor->name);
ast_free(mixmonitor->post_process);
} }
ast_free(mixmonitor->name);
ast_free(mixmonitor->post_process);
ast_free(mixmonitor->filename);
ast_free(mixmonitor->filename_write);
ast_free(mixmonitor->filename_read);
/* Free everything in the recipient list */ /* Free everything in the recipient list */
clear_mixmonitor_recipient_list(mixmonitor); clear_mixmonitor_recipient_list(mixmonitor);
@@ -513,6 +515,7 @@ static void mixmonitor_free(struct mixmonitor *mixmonitor)
if (mixmonitor->callid) { if (mixmonitor->callid) {
ast_callid_unref(mixmonitor->callid); ast_callid_unref(mixmonitor->callid);
} }
ast_free(mixmonitor); ast_free(mixmonitor);
} }
} }
@@ -587,7 +590,7 @@ static void mixmonitor_save_prep(struct mixmonitor *mixmonitor, char *filename,
} }
} }
static void *mixmonitor_thread(void *obj) static void *mixmonitor_thread(void *obj)
{ {
struct mixmonitor *mixmonitor = obj; struct mixmonitor *mixmonitor = obj;
char *fs_ext = ""; char *fs_ext = "";
@@ -1363,7 +1366,6 @@ static int unload_module(void)
res |= ast_manager_unregister("MixMonitorMute"); res |= ast_manager_unregister("MixMonitorMute");
res |= ast_manager_unregister("MixMonitor"); res |= ast_manager_unregister("MixMonitor");
res |= ast_manager_unregister("StopMixMonitor"); res |= ast_manager_unregister("StopMixMonitor");
return res; return res;
} }