]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Free successfully translated frame in fax_gateway_framehook
authorMatthew Jordan <mjordan@digium.com>
Wed, 4 Jan 2012 21:39:59 +0000 (21:39 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 4 Jan 2012 21:39:59 +0000 (21:39 +0000)
A frame that is translated via ast_translate is also duplicated via ast_frdup.
This will allocate a new frame on the heap, which needs to be free'd
at the appropriate time.  This issue reporter used valgrind to find that this
occurred in res_fax's fax_gateway_framehook; a quick search through the code
showed that only place this was currently not handling the translatted frame
properly.

(closes issue ASTERISK-19133)
Reported by: Sylvain Rochet

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@349608 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_fax.c

index 25758de68a0d5626f8ba916fc4fe3cc4ecdd5ef8..bc0eb18f8e224a3700704166fa52dd267f64c111 100644 (file)
@@ -3058,6 +3058,7 @@ 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);
                f = &ast_null_frame;
                ao2_ref(details, -1);
                return f;