Summary:ASTERISK-01830: [PATCH] Two leaks in logger.c
Reporter:thansen (thansen)Labels:
Date Opened:2004-06-15 14:27:53Date Closed:2008-01-15 14:58:29.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk-cxnet-closelogger-patch
Description:Added close_logger() to clean up logger.c's msglist. Fixes another two leakes reported by valgrind.



==8099== 8 bytes in 1 blocks are still reachable in loss record 1 of 11
==8099==    at 0x4002BA51: malloc (vg_replace_malloc.c:153)
==8099==    by 0x8053855: ast_verbose (logger.c:571)
==8099==    by 0x80960B5: ast_remotecontrol (asterisk.c:1333)
==8099==    by 0x809378A: main (asterisk.c:1579)

==8099== 84 bytes in 1 blocks are still reachable in loss record 8 of 11
==8099==    at 0x4002BA51: malloc (vg_replace_malloc.c:153)
==8099==    by 0x40364ABF: __strdup (in /lib/libc-2.3.2.so)
==8099==    by 0x805386E: ast_verbose (logger.c:580)
==8099==    by 0x80960B5: ast_remotecontrol (asterisk.c:1333)
Comments:By: Mark Spencer (markster) 2004-06-15 15:09:20

I must be missing something.  Is this code getting run at anytime other than when it shuts down or restarts?  In either case, all the memory is lost anyway right?

By: thansen (thansen) 2004-06-15 16:06:47

You got it right. But why leave it up to the system to clean it up? Should be properly freed IMHO. That is also why this is classified as a minor error.

Also, if it is an accepted practice to let the system be a garbage collector, then I won't bother fixing the last two leaks I've found. :)

By: Mark Spencer (markster) 2004-06-15 16:27:07

I'm not especially concerned about letting the system be a garbage collector in this case, but whatever, I won't argue.  Do me the favor, though, of combining these more or less together so we don't keep opening new bugs about this.

By: Mark Spencer (markster) 2004-06-16 21:29:22

I went ahead and put this one in by itself.  Just open a new one if you have more fixes, but try to put them all together in a single bug if you don't mind.  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 14:58:29.000-0600

Repository: asterisk
Revision: 3230

U   trunk/asterisk.c
U   trunk/asterisk.h
U   trunk/logger.c

r3230 | markster | 2008-01-15 14:58:28 -0600 (Tue, 15 Jan 2008) | 2 lines

Close logging stuff so system doesn't have to (bug ASTERISK-1830)