summaryrefslogtreecommitdiff
path: root/res/res_fax.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-01-05 23:58:26 +0000
committerMatthew Jordan <mjordan@digium.com>2012-01-05 23:58:26 +0000
commit89bbecc72496550f50f324a20b6208fb6d03c32d (patch)
tree3497a06cede1cbc5a32d57cb0790a06b9a8a8672 /res/res_fax.c
parent082fbbc6d014ea5db58c9b9a6c21e8d128f44ee5 (diff)
Fix premature free'ing of the frame committed in r349608
Even though we set the frame to the ast_null_frame and return that, the caller of the frame hook may still need the frame. This now is a bit more careful about when it frees the frame, i.e., only under the same conditions that applied when we duplicated it in the first place. ........ Merged revisions 349822 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_fax.c')
-rw-r--r--res/res_fax.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_fax.c b/res/res_fax.c
index 360c2d9d2..e7070fff2 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -3086,7 +3086,11 @@ static struct ast_frame *fax_gateway_framehook(struct ast_channel *chan, struct
* write would fail, or even if a failure would be fatal so for
* now we'll just ignore the return value. */
gateway->s->tech->write(gateway->s, f);
- ast_frfree(f);
+ if ((f->frametype == AST_FRAME_VOICE) && (f->subclass.format.id != AST_FORMAT_SLINEAR) && active->readtrans) {
+ /* Only free the frame if we translated / duplicated it - otherwise,
+ * let whatever is outside the frame hook do it */
+ ast_frfree(f);
+ }
f = &ast_null_frame;
ao2_ref(details, -1);
return f;