<h1>Project "FreeSWITCH Source" received a push.</h1>
<h2>branch: master updated</h2>
<pre>
via: 02234ae87db5fcca0168a140b5800618de65d3d9 (commit)
from: 145884c94ce9bcb25aa14d45e6d689b0d4af75ed (commit)
</pre>= COMMIT LOG ===========================================================
<div class="highlight"><pre>committer: Anthony Minessale
comments:
fix file leaks in mod_commandline_tts
<span style="color: #000080; font-weight: bold">diff --git a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c</span>
<span style="color: #000080; font-weight: bold">index 6b261f1..0f3bc41 100644</span>
<span style="color: #A00000">--- a/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c</span>
<span style="color: #00A000">+++ b/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c</span>
<span style="color: #800080; font-weight: bold">@@ -120,6 +120,11 @@ static switch_status_t tts_commandline_speech_close(switch_speech_handle_t *sh,</span>
        tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
        assert(info != NULL);
<span style="color: #00A000">+        if (switch_test_flag(info->fh, SWITCH_FILE_OPEN)) {</span>
<span style="color: #00A000">+                switch_core_file_close(info->fh);</span>
<span style="color: #00A000">+                unlink(info->file);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        return SWITCH_STATUS_SUCCESS;
}
<span style="color: #800080; font-weight: bold">@@ -130,6 +135,11 @@ static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *s</span>
        assert(info != NULL);
<span style="color: #00A000">+        if (switch_test_flag(info->fh, SWITCH_FILE_OPEN)) {</span>
<span style="color: #00A000">+                switch_core_file_close(info->fh);</span>
<span style="color: #00A000">+                unlink(info->file);</span>
<span style="color: #00A000">+        }</span>
<span style="color: #00A000">+</span>
        message = switch_core_strdup(sh->memory_pool, globals.command);
        tmp = switch_util_quote_shell_arg(text);
<span style="color: #800080; font-weight: bold">@@ -152,7 +162,7 @@ static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *s</span>
        }
        if (switch_core_file_open(info->fh, info->file, 0,        //number_of_channels,
<span style="color: #A00000">-                                                         0,        //samples_per_second,</span>
<span style="color: #00A000">+                                                         info->rate,        //samples_per_second,</span>
                                                         SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file: %s\n", info->file);
                return SWITCH_STATUS_FALSE;
<span style="color: #800080; font-weight: bold">@@ -171,11 +181,14 @@ static switch_status_t tts_commandline_speech_read_tts(switch_speech_handle_t *s</span>
        assert(info != NULL);
        if (switch_core_file_read(info->fh, data, &my_datalen) != SWITCH_STATUS_SUCCESS) {
<span style="color: #A00000">-                *datalen = my_datalen * 2;</span>
<span style="color: #00A000">+                switch_core_file_close(info->fh);</span>
<span style="color: #00A000">+                unlink(info->file);</span>
                return SWITCH_STATUS_FALSE;
        }
        *datalen = my_datalen * 2;
        if (datalen == 0) {
<span style="color: #00A000">+                switch_core_file_close(info->fh);</span>
<span style="color: #00A000">+                unlink(info->file);</span>
                return SWITCH_STATUS_BREAK;
        } else {
                return SWITCH_STATUS_SUCCESS;
</pre></div>
========================================================================<pre>
Summary of changes:
.../mod_tts_commandline/mod_tts_commandline.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
</pre>
<p>this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email<br />
For more info, see <a href="http://blog.chomperstomp.com/?p=630">http://blog.chomperstomp.com/?p=630</a>
-- <br />
FreeSWITCH Source</p>