]> git.ipfire.org Git - thirdparty/asterisk.git/commit
Fix a memory leak in cdr_radius.
authorRussell Bryant <russell@russellbryant.com>
Fri, 3 Apr 2009 01:57:44 +0000 (01:57 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 3 Apr 2009 01:57:44 +0000 (01:57 +0000)
commitf3dd49684f8d754f0fdcd5599e24a28b167783fa
tree88e55efc9759a1a10f759724397bbe56f5cdb614
parent09490bb688bddc902f63685de508f03856560d28
Fix a memory leak in cdr_radius.

I came across this while doing some testing of my ast_channel_ao2 branch.
After running a test overnight that generated over 5 million calls, Asterisk
had taken up about 1 GB of my system memory.  So, I re-ran the test with
MALLOC_DEBUG turned on.  However, it showed no leaks in Asterisk during the
test, even though Asterisk was still consuming it somehow.

Instead, I turned to valgrind, which when run with --leak-check=full, told
me exactly where the leak came from, which was from allocations inside the
radiusclient-ng library.  This explains why MALLOC_DEBUG did not report it.

After a bit of analysis, I found that we were leaking a little bit of memory
every time a CDR record was passed to cdr_radius.

I don't actually have a radius server set up to receive CDR records.  However,
I always have my development systems compile and install all modules.  In
addition to making sure there are not build errors across modules, always
loading modules helps find bugs like this, too, so it is strongly recommend for
all developers.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@186229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
cdr/cdr_radius.c