summaryrefslogtreecommitdiff
path: root/main/file.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2008-12-22 16:07:59 +0000
committerMark Michelson <mmichelson@digium.com>2008-12-22 16:07:59 +0000
commit9f7ce9da4104118efaafd07c141e8e3c3e63fb9d (patch)
treed0afc42ca56a3b05ca6b033bd47f7967032e376e /main/file.c
parent8556f306deafc07ffa6fdcca2cc545cca44cec7a (diff)
Fix a file playback crash and explicitly initialize values in func_timeout.c
A crash was brought up on the bugtracker. The first run through valgrind was full of legitimate complaints of uninitialized values in func_timeout when setting a response timeout. These were fixed but the crash persisted. A second run through showed the real problem. The reference counting used for filestreams was incorrect because there were some missing increments when a frame was read from a format module. (closes issue #14118) Reported by: blitzrage Patches: 14118v2.patch uploaded by putnopvut (license 60) Tested by: blitzrage git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@166267 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/file.c')
-rw-r--r--main/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main/file.c b/main/file.c
index 5e920cc3b..aee964649 100644
--- a/main/file.c
+++ b/main/file.c
@@ -714,6 +714,10 @@ static enum fsread_res ast_readaudio_callback(struct ast_filestream *s)
goto return_failure;
fr = s->fmt->read(s, &whennext);
+ if (fr) {
+ ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM);
+ ao2_ref(s, +1);
+ }
if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
if (fr)
ast_log(LOG_WARNING, "Failed to write frame\n");
@@ -764,6 +768,10 @@ static enum fsread_res ast_readvideo_callback(struct ast_filestream *s)
while (!whennext) {
struct ast_frame *fr = s->fmt->read(s, &whennext);
+ if (fr) {
+ ast_set_flag(fr, AST_FRFLAG_FROM_FILESTREAM);
+ ao2_ref(s, +1);
+ }
if (!fr || ast_write(s->owner, fr)) { /* no stream or error, as above */
if (fr)
ast_log(LOG_WARNING, "Failed to write frame\n");