diff options
-rw-r--r-- | apps/app_voicemail.c | 1 | ||||
-rw-r--r-- | main/app.c | 18 |
2 files changed, 15 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index af4e7f081..d99bced3d 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -6158,6 +6158,7 @@ static int msg_create_from_file(struct ast_vm_recording_data *recdata) ast_log(LOG_ERROR,"Unable to determine sample rate of recording %s\n", recdata->recording_file); } } + ast_closeframe(recording_fs); } /* If the duration was below the minimum duration for the user, let's just drop the whole thing now */ diff --git a/main/app.c b/main/app.c index fd19beeaf..dea5ee6ed 100644 --- a/main/app.c +++ b/main/app.c @@ -1782,18 +1782,20 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, ast_truncstream(others[x]); ast_closestream(others[x]); } - } - - if (prepend && outmsg) { + } else if (prepend && outmsg) { struct ast_filestream *realfiles[AST_MAX_FORMATS]; struct ast_frame *fr; for (x = 0; x < fmtcnt; x++) { snprintf(comment, sizeof(comment), "Opening the real file %s.%s\n", recordfile, sfmt[x]); realfiles[x] = ast_readfile(recordfile, sfmt[x], comment, O_RDONLY, 0, 0); - if (!others[x] || !realfiles[x]) { + if (!others[x]) { break; } + if (!realfiles[x]) { + ast_closestream(others[0]); + continue; + } /*!\note Same logic as above. */ if (dspsilence) { ast_stream_rewind(others[x], dspsilence - 200); @@ -1810,7 +1812,15 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, ast_verb(4, "Recording Format: sfmts=%s, prependfile %s, recordfile %s\n", sfmt[x], prependfile, recordfile); ast_filedelete(prependfile, sfmt[x]); } + } else { + for (x = 0; x < fmtcnt; x++) { + if (!others[x]) { + break; + } + ast_closestream(others[x]); + } } + if (rfmt && ast_set_read_format(chan, rfmt)) { ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_format_get_name(rfmt), ast_channel_name(chan)); } |