[Home]

Summary:ASTERISK-14720: [patch] Memory leak in res_config_ldap when using realtime
Reporter:Andrew Ofisher (zaltar)Labels:
Date Opened:2010-12-07 18:07:32.000-0600Date Closed:2011-01-29 17:10:07.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_config_ldap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) res_config_ldap.patch
Description:Found three places where memory was leaked using realtime with ldap on 1.8.0.  Patch is against trunk (rev 297904)

==13451== Memcheck, a memory error detector
==13451== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==13451== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==13451== Command: asterisk -f -vvv -cd
==13451== Parent PID: 14587

==13451==
==13451== 8,182 bytes in 499 blocks are definitely lost in loss record 2,797 of 2,931
==13451==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==13451==    by 0x3988608AC4: ber_memalloc_x (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988603B4C: ber_get_stringbv (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988603D39: ber_get_stringa (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988604C18: ber_scanf (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x31A7A1D7FE: ldap_next_attribute (in /usr/lib64/libldap-2.4.so.2.1.0)
==13451==    by 0xDB06693: realtime_ldap_entry_to_var (res_config_ldap.c:346)
==13451==    by 0xDB06776: realtime_ldap_result_to_vars (res_config_ldap.c:379)
==13451==    by 0xDB085C1: realtime_ldap_base_ap (res_config_ldap.c:828)
==13451==    by 0xDB08BDB: realtime_multi_ldap (res_config_ldap.c:977)
==13451==    by 0x494826: ast_load_realtime_multientry (config.c:2253)
==13451==    by 0xEA3E781: load_realtime_queue (app_queue.c:2184)



==13451==    
==13451== 3,280 bytes in 200 blocks are definitely lost in loss record 2,687 of 2,931
==13451==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==13451==    by 0x3988608AC4: ber_memalloc_x (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988603B4C: ber_get_stringbv (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988603D39: ber_get_stringa (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988604C18: ber_scanf (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x31A7A1D7FE: ldap_next_attribute (in /usr/lib64/libldap-2.4.so.2.1.0)
==13451==    by 0xDB0713B: realtime_ldap_result_to_vars (res_config_ldap.c:511)
==13451==    by 0xDB085C1: realtime_ldap_base_ap (res_config_ldap.c:828)
==13451==    by 0xDB08BDB: realtime_multi_ldap (res_config_ldap.c:977)
==13451==    by 0x494826: ast_load_realtime_multientry (config.c:2253)
==13451==    by 0xEA3E781: load_realtime_queue (app_queue.c:2184)
==13451==    by 0xEA515C8: __queues_show (app_queue.c:6755)


==13451==
==13451== 156 bytes in 4 blocks are definitely lost in loss record 1,725 of 2,931
==13451==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==13451==    by 0x3988608AC4: ber_memalloc_x (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988603B4C: ber_get_stringbv (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988603D39: ber_get_stringa (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x3988604C18: ber_scanf (in /usr/lib64/liblber-2.4.so.2.1.0)
==13451==    by 0x31A7A1AADB: ldap_get_dn (in /usr/lib64/libldap-2.4.so.2.1.0)
==13451==    by 0xDB0A70E: update_ldap (res_config_ldap.c:1340)
==13451==    by 0x4949AB: ast_update_realtime (config.c:2277)
==13451==    by 0xE55FE74: realtime_update_peer (chan_sip.c:4223)
==13451==    by 0xE560756: update_peer (chan_sip.c:4353)
==13451==    by 0xE591987: register_verify (chan_sip.c:13798)
==13451==    by 0xE5C4987: handle_request_register (chan_sip.c:23388)
Comments:By: Sean Bright (seanbright) 2011-01-29 17:05:15.000-0600

Looks good.  Thanks for the patch!

By: Digium Subversion (svnbot) 2011-01-29 17:05:26.000-0600

Repository: asterisk
Revision: 304865

U   branches/1.6.2/res/res_config_ldap.c

------------------------------------------------------------------------
r304865 | seanbright | 2011-01-29 17:05:26 -0600 (Sat, 29 Jan 2011) | 7 lines

Plug some memory leaks in the LDAP realtime driver.

(closes issue ASTERISK-14720)
Reported by: zaltar
Patches:
     res_config_ldap.patch uploaded by zaltar (license 1148)

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

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

By: Digium Subversion (svnbot) 2011-01-29 17:07:18.000-0600

Repository: asterisk
Revision: 304866

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

------------------------------------------------------------------------
r304866 | seanbright | 2011-01-29 17:07:18 -0600 (Sat, 29 Jan 2011) | 14 lines

Merged revisions 304865 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r304865 | seanbright | 2011-01-29 18:05:25 -0500 (Sat, 29 Jan 2011) | 7 lines
 
 Plug some memory leaks in the LDAP realtime driver.
 
 (closes issue ASTERISK-14720)
 Reported by: zaltar
 Patches:
       res_config_ldap.patch uploaded by zaltar (license 1148)
........

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

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

By: Digium Subversion (svnbot) 2011-01-29 17:10:07.000-0600

Repository: asterisk
Revision: 304867

_U  trunk/
U   trunk/res/res_config_ldap.c

------------------------------------------------------------------------
r304867 | seanbright | 2011-01-29 17:10:06 -0600 (Sat, 29 Jan 2011) | 21 lines

Merged revisions 304866 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r304866 | seanbright | 2011-01-29 18:07:18 -0500 (Sat, 29 Jan 2011) | 14 lines
 
 Merged revisions 304865 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r304865 | seanbright | 2011-01-29 18:05:25 -0500 (Sat, 29 Jan 2011) | 7 lines
   
   Plug some memory leaks in the LDAP realtime driver.
   
   (closes issue ASTERISK-14720)
   Reported by: zaltar
   Patches:
         res_config_ldap.patch uploaded by zaltar (license 1148)
 ........
................

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

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