[Home]

Summary:ASTERISK-27869: couple of memory leaks (detected by cppcheck)
Reporter:Ilya Shipitsin (chipitsine)Labels:
Date Opened:2018-05-21 05:15:35Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Resources/res_ael_share
Versions:13.21.0 15.4.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:{noformat}
[res/ael/pval.c:3632]: (error) Memory leak: for_loop
[res/ael/pval.c:3672]: (error) Memory leak: while_loop
{noformat}
Comments:By: Asterisk Team (asteriskteam) 2018-05-21 05:15:36.077-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Richard Mudgett (rmudgett) 2018-05-21 12:02:08.644-0500

Yep.  The 'for_loop' and 'while_loop' variables do appear to be leaked when gen_prios() returns non-zero for an error.  When gen_prios() returns error, it causes ast_compile_ael2() to fail, which causes the AEL diaplan module load to decline/fail.  gen_prios() returns error because of a memory allocation failure.  There is no good fix for the leak because of how the code is written.  The best way I think it could be fixed without rewriting gen_prios() is to defer returning error until the end of the switch case which would be after the associated linkprio() calls have linked the leaked memory items into the exten object.

Please be aware that the Asterisk Extension Language (AEL) is an extended support feature \[1] with no designated maintainer.  Support must come from the community so response times will reflect that.

\[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States