Summary:ASTERISK-10789: possible memory leak in asp_dsp_process
Reporter:Dmitry Andrianov (dimas)Labels:
Date Opened:2007-11-16 10:13:34.000-0600Date Closed:2007-12-07 17:29:19.000-0600
Versions:Frequency of
Environment:Attachments:( 0) dsp.c.patch
Description:While adding fax tone detection to ReceiveFAX application I discovered one strange thing in dsp.c. It looks like ast_dsp_process function is supposed to free the frame it received as input (except for the case when it returns that frame back).
However it looks like it does not always free the input frame. Namely, there are two checks:

       if ((dsp->features & DSP_FEATURE_SILENCE_SUPPRESS) && silence) {
       if ((dsp->features & DSP_FEATURE_BUSY_DETECT) && ast_dsp_busydetect(dsp)) {

which do not do ast_frfree(af) although they return another frame.

To me it looks like a bug but it can be a feature :) so it worth someone with knowledge to take a look. The fix is straightforward so I'm not supplying the patch.


probably 1.4 has the same code...
Comments:By: Eliel Sardanons (eliel) 2007-11-16 12:07:47.000-0600

I review the code and you are right, it should be freed.
Patch uploaded, I also check some weird conditions on some channels that doesn't check the return value of this function, and they don't "know" or doit wrong when the return value = NULL, that is a impossible condition (I think (??)).

By: Digium Subversion (svnbot) 2007-12-07 17:29:18.000-0600

Repository: asterisk
Revision: 91891

_U  trunk/
U   trunk/main/dsp.c

r91891 | qwell | 2007-12-07 17:29:17 -0600 (Fri, 07 Dec 2007) | 13 lines

Merged revisions 91890 via svnmerge from

(closes issue ASTERISK-10789)
r91890 | qwell | 2007-12-07 17:29:01 -0600 (Fri, 07 Dec 2007) | 4 lines

We need to make sure we free the input frame if we return a different frame in ast_dsp_process.

Issue 11273, pointed out by dimas, with a patch by eliel.