diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-12 23:22:44 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-02-12 23:22:44 +0000 |
commit | 4a309d353abd9f6d1a359d4882ad24e1916d4ed1 (patch) | |
tree | cada5dca08b9e2436e2e1d9d25e98bfef4eb5f61 /main/file.c | |
parent | b92b74aac1e630ff9f2efc06624283a5a4a81c87 (diff) |
Fix a place where filestreams were not refcounted properly
This section was already present in trunk and other branches,
but did not exist in 1.4.
(closes issue #14395)
Reported by: ZX81
Patches:
14395.patch uploaded by putnopvut (license 60)
Tested by: ZX81
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@175407 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/file.c')
-rw-r--r-- | main/file.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/main/file.c b/main/file.c index 5836e21e3..faca5a9be 100644 --- a/main/file.c +++ b/main/file.c @@ -729,11 +729,20 @@ 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) + if (fr) { ast_log(LOG_WARNING, "Failed to write frame\n"); + ast_frfree(fr); + } goto return_failure; } + if (fr) { + ast_frfree(fr); + } } if (whennext != s->lasttimeout) { #ifdef HAVE_DAHDI |