[asterisk-commits] coreyfarrell: branch 11 r427024 - in /branches/11: ./ apps/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Nov 2 02:03:22 CST 2014
Author: coreyfarrell
Date: Sun Nov 2 02:03:18 2014
New Revision: 427024
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=427024
Log:
Fix ast_writestream leaks
Fix cleanup in __ast_play_and_record where others[x] may be leaked.
This was caught where prepend != NULL && outmsg != NULL, once
realfile[x] == NULL any further others[x] would be leaked. A cleanup
block was also added for prepend != NULL && outmsg == NULL.
11+: Fix leak of ast_writestream recording_fs in
app_voicemail:leave_voicemail.
ASTERISK-24476 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4138/
........
Merged revisions 427023 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/11/ (props changed)
branches/11/apps/app_voicemail.c
branches/11/main/app.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/11/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_voicemail.c?view=diff&rev=427024&r1=427023&r2=427024
==============================================================================
--- branches/11/apps/app_voicemail.c (original)
+++ branches/11/apps/app_voicemail.c Sun Nov 2 02:03:18 2014
@@ -6041,6 +6041,7 @@
ast_getformatbyname(recdata->recording_ext, &result);
duration = (int) (framelength / ast_format_rate(&result));
}
+ ast_closeframe(recording_fs);
}
/* If the duration was below the minimum duration for the user, let's just drop the whole thing now */
Modified: branches/11/main/app.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/app.c?view=diff&rev=427024&r1=427023&r2=427024
==============================================================================
--- branches/11/main/app.c (original)
+++ branches/11/main/app.c Sun Nov 2 02:03:18 2014
@@ -1385,17 +1385,19 @@
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[x]);
+ continue;
}
/*!\note Same logic as above. */
if (dspsilence) {
@@ -1413,7 +1415,15 @@
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.id && ast_set_read_format(chan, &rfmt)) {
ast_log(LOG_WARNING, "Unable to restore format %s to channel '%s'\n", ast_getformatname(&rfmt), ast_channel_name(chan));
}
More information about the asterisk-commits
mailing list