[Home]

Summary:ASTERISK-02936: Memory leak in ast_expr.y
Reporter:klictel (klictel)Labels:
Date Opened:2004-12-07 12:53:33.000-0600Date Closed:2008-01-15 15:15:53.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:We habe been experiencing memory usage increasing in Asterisk, sometimes reaching over 150MB. After compiling Asterisk with the MALLOC_DEBUG option, I was able to see that some memory was allocated and never freed in the ast_expr.y. Note that the leak is obvious because I do an extensive usage of variable in the dialplan (GotoIf). Basically, I noticed that the free_value() function frees the contents of the structure 'struct val', but does not free the structure as is. I did the followng modification to ast_expr.y and the leak seems to go away.

****** ADDITIONAL INFORMATION ******

218,220d217
<
<       if (vp)
<               free (vp);
Comments:By: Russell Bryant (russell) 2004-12-07 14:49:59.000-0600

fixed in stable and head

Thanks!

By: klictel (klictel) 2004-12-07 14:50:23.000-0600

Sorry for the backwards patch. Here it is again:

217a218,220
>
>       if (vp)
>               free (vp);

By: Russell Bryant (russell) 2004-12-07 14:51:49.000-0600

No worries.  I figured it out.  Thanks again for the fix!

By: Digium Subversion (svnbot) 2008-01-15 15:15:52.000-0600

Repository: asterisk
Revision: 4397

U   branches/v1-0/ast_expr.y

------------------------------------------------------------------------
r4397 | russell | 2008-01-15 15:15:51 -0600 (Tue, 15 Jan 2008) | 2 lines

fix mem leak in free_value (bug ASTERISK-2936)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4397

By: Digium Subversion (svnbot) 2008-01-15 15:15:53.000-0600

Repository: asterisk
Revision: 4398

U   trunk/ast_expr.y

------------------------------------------------------------------------
r4398 | russell | 2008-01-15 15:15:52 -0600 (Tue, 15 Jan 2008) | 2 lines

fix mem leak in free_value (bug ASTERISK-2936)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4398