[Asterisk-Dev] SIP_MYSQL_FRIENDS

Chris Parker cparker at segv.org
Mon Jan 31 07:38:23 MST 2005


On Jan 31, 2005, at 8:04 AM, Marcin Kwiatkowski wrote:

> Hello,
>
> Is MySQL peers and users *'s code stable (1.0.4)? We probably have 
> found some memory leaks. In chan_sip.c function find_user if 
> MYSQL_USERS is defined function mysql_user is called. This function 
> malloc's memory for sip_user struct. find_user is called from another 
> function update_user_counter. If find_user returns pointer to sip_user 
> (found in SQL, not list) this data is never released. It looks like 
> update_user_counter guess returned pointer is static list member. 
> Another function - check_user_full also calls find_user, in case where 
> user is found, but host access fails (line 5627) user variable is set 
> to null without memory releasing (line 5629).
> Probably there is many other similar leaks in find_peer (memory for 
> sip_peer struct is never released).

There quite likely are other memory leaks and issues with the MYSQL 
code in
chan_sip.c

Unless you want to patch it yourself, you won't find much help from the 
project,
as the party line seems to be that the MYSQL hacks in chan_sip.c are 
deprecated
and are going away in the future.  ( Though for the interim, they 
remain as-is,
but not fully supported going forward ).

The preferred solution, is to use something like res_config_odbc, since 
that will
be ( in theory ) more supportable/extensible way of doing SQL lookups 
going
forward.

Anyone else, correct me if I'm wrong here.

-Chris
-- 
    \\\|||///  \   Chris Parker    -   Segmentation Fault ( core dumped )
    \ ~   ~ /   \
    | @   @ |    \   http://www.segv.org     |    cparker at segv.org
oOo   (_)   oOo  \
------------------------------------------------------------------------
#             OS's are nothing more than device drivers!               #




More information about the asterisk-dev mailing list