[Home]

Summary:ASTERISK-15148: [patch] Memory leak in res_config_ldap when using realtime extensions
Reporter:Nito Martinez (nito)Labels:
Date Opened:2009-11-16 17:32:56.000-0600Date Closed:2010-01-14 17:18:41.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_config_ldap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) issue16257_20100111.diff
Description:When using realtime extensions we get a memory leak.

Configuration line

./configure --prefix=/usr/local/asterisk-1.6.0.17 --disable-xmldoc --sysconfdir=/etc --localstatedir=/var --with-netsnmp

we also tried with make menuconfig selecting dontoptimize and debug_malloc.

Running with valgrind we get:

--20782-- Command line
--20782--    /usr/local/asterisk/sbin/asterisk
--20782--    -vvvvddddddddcg
--20782-- Startup, with flags:
--20782--    -v
--20782--    --log-file=/tmp/valgrind-1.6.0.17.dontoptimze.out
--20782--    --leak-check=full
--20782--    --trace-children=yes
--20782--    --show-reachable=yes
--20782--    --leak-resolution=high
--20782--    --num-callers=50


and

==20782== 7,307,920 bytes in 30,632 blocks are still reachable in loss record 2,
151 of 2,151
==20782==    at 0x4C278AE: malloc (vg_replace_malloc.c:207)
==20782==    by 0x43E825: __ast_alloc_region (astmm.c:114)
==20782==    by 0x43E7C4: __ast_calloc (astmm.c:203)
==20782==    by 0x4672D8: ast_variable_new (config.c:214)
==20782==    by 0x919D92C: realtime_ldap_entry_to_var (res_config_ldap.c:323)
==20782==    by 0x919DA71: realtime_ldap_result_to_vars (res_config_ldap.c:367)
==20782==    by 0x919F82E: realtime_ldap_base_ap (res_config_ldap.c:817)
==20782==    by 0x919FBCB: realtime_ldap (res_config_ldap.c:902)
==20782==    by 0x46D624: ast_load_realtime_helper (config.c:2045)
==20782==    by 0x46D826: ast_load_realtime (config.c:2068)
==20782==    by 0x165824D2: realtime_switch_common (pbx_realtime.c:93)
==20782==    by 0x16582841: realtime_common (pbx_realtime.c:140)
==20782==    by 0x16582898: realtime_exists (pbx_realtime.c:147)
==20782==    by 0x4BB552: pbx_find_extension (pbx.c:2264)
==20782==    by 0x4BE1D9: pbx_extension_helper (pbx.c:3072)
==20782==    by 0x4BF8A4: ast_exists_extension (pbx.c:3559)
==20782==    by 0x10FA763D: get_destination (chan_sip.c:11474)
==20782==    by 0x10FC7DC9: handle_request_invite (chan_sip.c:17655)
==20782==    by 0x10FCF1A2: handle_incoming (chan_sip.c:19190)
==20782==    by 0x10FD0061: handle_request_do (chan_sip.c:19464)
==20782==    by 0x10FCFA94: sipsock_read (chan_sip.c:19370)
==20782==    by 0x49FCDE: ast_io_wait (io.c:288)
==20782==    by 0x10FD130A: do_monitor (chan_sip.c:19865)
==20782==    by 0x51409A: dummy_start (utils.c:861)
==20782==    by 0x59813B9: start_thread (in /lib/libpthread-2.9.so)
==20782==    by 0x54E9FCC: clone (in /lib/libc-2.9.so)


****** STEPS TO REPRODUCE ******


extensions.conf
===============
[default]
switch => Realtime

[vm]
exten => 123,1,ANSWER
exten => 123,2,Verbose("Voicemail from ${EXTEN} ${CALLERID(num)} ${CALLERID(ALL)}")
exten => 123,3,Set(CHANNEL(LANGUAGE)=es)
exten => 123,4,VoicemailMain(s${CALLERID(num)})
exten => 123,5,HANGUP


LDAP entry:

dn: cn=123-1,ou=extensions,dc=qindel,dc=com
cn: 123-1
objectClass: top
objectClass: AsteriskExtension
AstContext: default
AstExtension: 123
AstPriority: 1
AstApplication: Goto
AstApplicationData: vm,123,1




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

Tested also against svn Revision: 229673 with same results
Comments:By: Sean Bright (seanbright) 2010-01-11 16:23:19.000-0600

Please test the attached patch and report results.  The patch was made against 1.6.0.17.

By: Digium Subversion (svnbot) 2010-01-14 17:13:03.000-0600

Repository: asterisk
Revision: 240271

U   trunk/res/res_config_ldap.c

------------------------------------------------------------------------
r240271 | seanbright | 2010-01-14 17:13:03 -0600 (Thu, 14 Jan 2010) | 7 lines

Plug a memory leak in res_config_ldap.

(closes issue ASTERISK-15148)
Reported by: nito
Patches:
     issue16257_20100111.diff uploaded by seanbright (license 71)

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

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

By: Digium Subversion (svnbot) 2010-01-14 17:18:31.000-0600

Repository: asterisk
Revision: 240278

_U  branches/1.6.0/
U   branches/1.6.0/res/res_config_ldap.c

------------------------------------------------------------------------
r240278 | seanbright | 2010-01-14 17:18:30 -0600 (Thu, 14 Jan 2010) | 14 lines

Merged revisions 240271 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r240271 | seanbright | 2010-01-14 18:13:02 -0500 (Thu, 14 Jan 2010) | 7 lines
 
 Plug a memory leak in res_config_ldap.
 
 (closes issue ASTERISK-15148)
 Reported by: nito
 Patches:
       issue16257_20100111.diff uploaded by seanbright (license 71)
........

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

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

By: Digium Subversion (svnbot) 2010-01-14 17:18:37.000-0600

Repository: asterisk
Revision: 240279

_U  branches/1.6.1/
U   branches/1.6.1/res/res_config_ldap.c

------------------------------------------------------------------------
r240279 | seanbright | 2010-01-14 17:18:37 -0600 (Thu, 14 Jan 2010) | 14 lines

Merged revisions 240271 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r240271 | seanbright | 2010-01-14 18:13:02 -0500 (Thu, 14 Jan 2010) | 7 lines
 
 Plug a memory leak in res_config_ldap.
 
 (closes issue ASTERISK-15148)
 Reported by: nito
 Patches:
       issue16257_20100111.diff uploaded by seanbright (license 71)
........

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

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

By: Digium Subversion (svnbot) 2010-01-14 17:18:41.000-0600

Repository: asterisk
Revision: 240280

_U  branches/1.6.2/
U   branches/1.6.2/res/res_config_ldap.c

------------------------------------------------------------------------
r240280 | seanbright | 2010-01-14 17:18:40 -0600 (Thu, 14 Jan 2010) | 14 lines

Merged revisions 240271 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r240271 | seanbright | 2010-01-14 18:13:02 -0500 (Thu, 14 Jan 2010) | 7 lines
 
 Plug a memory leak in res_config_ldap.
 
 (closes issue ASTERISK-15148)
 Reported by: nito
 Patches:
       issue16257_20100111.diff uploaded by seanbright (license 71)
........

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

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