aboutsummaryrefslogtreecommitdiffstats
path: root/main/file.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-22 16:10:14 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-12-22 16:10:14 +0000
commite977b3074a506363f1209838e96aa96bc09c995b (patch)
tree0d93f9f9430896f1d67fb4af6c4e91d28ccc801d /main/file.c
parentda514d5aa3b105e7ea6e4fff4e7c52ffff0d7be5 (diff)
Merged revisions 166267 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r166267 | mmichelson | 2008-12-22 10:07:59 -0600 (Mon, 22 Dec 2008) | 17 lines 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: http://svn.digium.com/svn/asterisk/branches/1.6.0@166271 f38db490-d61c-443f-a65b-d21fe96a405b
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 4468d2276..099f22953 100644
--- a/main/file.c
+++ b/main/file.c
@@ -659,6 +659,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");
@@ -715,6 +719,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");