]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSMOD-35: mod_tts_commandline core dump, temp file problem.
authorMathieu Parent <math.parent@gmail.com>
Thu, 8 Apr 2010 18:49:56 +0000 (20:49 +0200)
committerMathieu Parent <math.parent@gmail.com>
Thu, 8 Apr 2010 18:49:56 +0000 (20:49 +0200)
flush can be called several times

src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c

index f86b9d5156677b883c8df7d3b2e62bf789c2bdb2..6b261f1d9660e8ca2e6d133cad2d96e86d790ece 100644 (file)
@@ -186,10 +186,14 @@ static void tts_commandline_speech_flush_tts(switch_speech_handle_t *sh)
 {
        tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
        assert(info != NULL);
-
-       switch_core_file_close(info->fh);
-       if (unlink(info->file) != 0) {
-               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sound file [%s] delete failed\n", info->file);
+       
+       if (info->fh != NULL && info->fh->file_interface != NULL) {
+               switch_core_file_close(info->fh);
+       }
+       if (switch_file_exists(info->file, NULL) == SWITCH_STATUS_SUCCESS) {
+               if (unlink(info->file) != 0) {
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sound file [%s] delete failed\n", info->file);
+               }
        }
 }