aboutsummaryrefslogtreecommitdiffstats
path: root/cdr
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-03 02:06:40 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-03 02:06:40 +0000
commit082a1e3f33030fc17a30312fbed6bdfece929724 (patch)
tree6f5b7e3c538ceed954c2cd62aa3a01fcdf67eb53 /cdr
parente2cd8ca3c190159b3a8a11b0d1ea7b78efd35820 (diff)
Merged revisions 186230 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r186230 | russell | 2009-04-02 21:03:48 -0500 (Thu, 02 Apr 2009) | 29 lines Merged revisions 186229 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r186229 | russell | 2009-04-02 20:57:44 -0500 (Thu, 02 Apr 2009) | 21 lines 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: http://svn.digium.com/svn/asterisk/branches/1.6.1@186232 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr')
-rw-r--r--cdr/cdr_radius.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c
index 67910ce0e..6f7280348 100644
--- a/cdr/cdr_radius.c
+++ b/cdr/cdr_radius.c
@@ -205,12 +205,18 @@ static int radius_log(struct ast_cdr *cdr)
if (build_radius_record(&tosend, cdr)) {
ast_debug(1, "Unable to create RADIUS record. CDR not recorded!\n");
- return result;
+ goto return_cleanup;
}
result = rc_acct(rh, 0, tosend);
- if (result != OK_RC)
+ if (result != OK_RC) {
ast_log(LOG_ERROR, "Failed to record Radius CDR record!\n");
+ }
+
+return_cleanup:
+ if (tosend) {
+ rc_avpair_free(tosend);
+ }
return result;
}