Summary:ASTERISK-08745: [patch] memory leaks with IAX realtime
Reporter:Ben Smithurst (bsmithurst)Labels:
Date Opened:2007-02-07 03:19:36.000-0600Date Closed:2007-06-30 09:19:58
Versions:Frequency of
Environment:Attachments:( 0) chan_iax2.leaks.patch
Description:When investigating reasons for asterisk on our IAX server to be chewing up memory, I have identified a couple of leaks related I believe to the realtime support.

The first is in realtime_peer, where it appears an ast_variable list is not being correctly freed in some cases.

Secondly, in check_access, the temporary user entry was not always being destroyed.  It was being freed in the case where the ast_db_get fails, however I cannot see what is special about this case.  As far as I can tell no reference to user is kept so I think it should always be freed.

The attached patch appears to fix these.  We run quite a busy IAX server so I will keep an eye on the server abd report any problems I find.

The patch was done on 1.4.0 but applies cleanly to trunk.  However I do not have a server running trunk at the moment so cannot confirm if the leaks have been fixed some other way which would still let the patch apply.  Given the nature of the leaks I don't think they would have been fixed elsewhere in the code though.
Comments:By: Ben Smithurst (bsmithurst) 2007-02-07 05:18:58.000-0600

by the way, I do not have rtcachefriends turned on for IAX users ... I suspect this may work around one or both leaks, but I thought it better to try to fix the leak properly.

By: Joshua C. Colp (jcolp) 2007-02-07 09:47:36.000-0600

Fixed in 1.2 as of revision 53357, 1.4 as of revision 53358, and trunk as of revision 53359 along with another that I noticed. Thanks!