[Home]

Summary:ASTERISK-09210: memory leak in get_filestream
Reporter:Lior M (liorm)Labels:
Date Opened:2007-04-06 04:07:56Date Closed:2007-04-07 20:42:09
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20070406__bug9486__2.diff.txt
( 1) 20070406__bug9486.diff.txt
Description:not all memory allocated in get_filestream is released.
I have a dialplan which makes a lot of controlplayback commands.
the allocations are in get_filestream at line 286 of file.c.



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

ivr*CLI> memory show summary
       29 bytes in 1 allocations in file 'ael.flex'
       36 bytes in 1 allocations in file 'sig.c'
     1024 bytes in 1 allocations in file 'hist.c'
     1024 bytes in 1 allocations in file 'search.c'
      584 bytes in 2 allocations in file 'btree/bt_open.c'
       18 bytes in 2 allocations in file 'app_dial.c'
     1984 bytes in 4 allocations in file 'map.c'
    16536 bytes in 2 allocations in file 'translate.c'
      516 bytes in 1 allocations in file 'enum.c'
      244 bytes in 1 allocations in file 'iax2-provision.c'
     3112 bytes in 4 allocations in file 'chared.c'
    25436 bytes in 2 allocations in file 'app_followme.c'
      156 bytes in 4 allocations in file 'devicestate.c'
       20 bytes in 1 allocations in file 'btree/bt_utils.c'
       76 bytes in 2 allocations in file 'history.c'
     3434 bytes in 4 allocations in file 'chan_oss.c'
      785 bytes in 2 allocations in file 'el.c'
      564 bytes in 10 allocations in file 'chan_local.c'
     1644 bytes in 16 allocations in file '/usr/src/asterisk-1.4.1/include/asteris'
      752 bytes in 2 allocations in file 'res_crypto.c'
      864 bytes in 5 allocations in file 'res_musiconhold.c'
     1496 bytes in 2 allocations in file 'dsp.c'
     4340 bytes in 7 allocations in file 'cdr.c'
     6942 bytes (      6942 cache) in 24 allocations in file 'frame.c'
     6128 bytes in 20 allocations in file 'channel.c'
     1869 bytes in 63 allocations in file 'manager.c'
      676 bytes in 13 allocations in file 'sched.c'
    25740 bytes in 20 allocations in file 'io.c'
    44796 bytes in 21 allocations in file 'chan_iax2.c'
    10156 bytes in 157 allocations in file 'loader.c'
     2044 bytes in 52 allocations in file 'key.c'
     5302 bytes in 60 allocations in file 'utils.c'
    10681 bytes in 254 allocations in file 'pbx_config.c'
    11460 bytes in 158 allocations in file 'config.c'
      180 bytes in 2 allocations in file 'netsock.c'
      882 bytes in 56 allocations in file 'pbx_ael.c'
      576 bytes in 4 allocations in file 'logger.c'
     9312 bytes in 3 allocations in file 'mpool/mpool.c'
     6522 bytes in 245 allocations in file 'asterisk.c'
     5238 bytes in 329 allocations in file 'cli.c'
   540204 bytes in 130 allocations in file 'chan_zap.c'
     8634 bytes in 57 allocations in file 'term.c'
    20218 bytes in 1160 allocations in file 'res_indications.c'
    30885 bytes in 540 allocations in file 'pbx.c'
235026380 bytes in 3766 allocations in file 'file.c'
     5801 bytes in 158 allocations in file 'chanvars.c'
235845300 bytes allocated (6942 in caches) in 7369 allocations
Comments:By: Tilghman Lesher (tilghman) 2007-04-06 10:18:27

liorm:  please try this patch.  This should alleviate your issue.

By: Tilghman Lesher (tilghman) 2007-04-06 11:30:36

Oops, file pointed out one possible problem.  New patch uploaded.

By: SR67 (soulreaver67) 2007-04-06 19:48:52

First of all-- NIL all pointers _before_ you allocate them.  Next, check the pointer for NIL _after_ you attempt to allocate it.  And lastly (MOST IMPORTANT), reset the pointer to NIL immediately following discarding the memory.  That way if you try to use that invalid pointer again, you find out quickly.

By: Lior M (liorm) 2007-04-07 00:55:18

it works, thanks

By: Tilghman Lesher (tilghman) 2007-04-07 18:16:07

soulraver67:  do you have a specific problem with this patch?  As far as I can see, we're already doing that.

By: Tilghman Lesher (tilghman) 2007-04-07 20:42:09

Committed to 1.2 in 60660, merged in 60661, 60662.