[Asterisk-code-review] raidus cdr,cel: Fix old memleak in unload (asterisk[master])
Badalian Vyacheslav
asteriskteam at digium.com
Mon Oct 10 11:51:05 CDT 2016
Badalian Vyacheslav has uploaded a new change for review.
https://gerrit.asterisk.org/4059
Change subject: raidus cdr,cel: Fix old memleak in unload
......................................................................
raidus cdr,cel: Fix old memleak in unload
ASTERISK-26455 #close
Change-Id: Ic17c38de67583e971d78fe18807d1a9faf8f0afd
---
M cdr/cdr_radius.c
M cel/cel_radius.c
2 files changed, 6 insertions(+), 22 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/59/4059/1
diff --git a/cdr/cdr_radius.c b/cdr/cdr_radius.c
index e1a639c..2120859 100644
--- a/cdr/cdr_radius.c
+++ b/cdr/cdr_radius.c
@@ -91,6 +91,8 @@
static const char name[] = "radius";
static const char cdr_config[] = "cdr.conf";
+static const char *rc_cdr_log_name = "asterisk";
+
#ifdef FREERADIUS_CLIENT
static char radiuscfg[PATH_MAX] = "/etc/radiusclient/radiusclient.conf";
#else
@@ -265,17 +267,7 @@
} else
return AST_MODULE_LOAD_DECLINE;
- /*
- * start logging
- *
- * NOTE: Yes this causes a slight memory leak if the module is
- * unloaded. However, it is better than a crash if cdr_radius
- * and cel_radius are both loaded.
- */
- tmp = ast_strdup("asterisk");
- if (tmp) {
- rc_openlog((char *) tmp);
- }
+ rc_openlog(rc_cdr_log_name);
/* read radiusclient-ng config file */
if (!(rh = rc_read_config(radiuscfg))) {
diff --git a/cel/cel_radius.c b/cel/cel_radius.c
index 3c20e97..d7d7762 100644
--- a/cel/cel_radius.c
+++ b/cel/cel_radius.c
@@ -89,6 +89,8 @@
static char radiuscfg[PATH_MAX] = "/etc/radiusclient-ng/radiusclient.conf";
#endif
+static const char *rc_cel_log_name = "asterisk";
+
static struct ast_flags global_flags = { RADIUS_FLAG_USEGMTIME | RADIUS_FLAG_LOGUNIQUEID | RADIUS_FLAG_LOGUSERFIELD };
static rc_handle *rh = NULL;
@@ -237,17 +239,7 @@
return AST_MODULE_LOAD_DECLINE;
}
- /*
- * start logging
- *
- * NOTE: Yes this causes a slight memory leak if the module is
- * unloaded. However, it is better than a crash if cdr_radius
- * and cel_radius are both loaded.
- */
- tmp = ast_strdup("asterisk");
- if (tmp) {
- rc_openlog((char *) tmp);
- }
+ rc_openlog(rc_cel_log_name);
/* read radiusclient-ng config file */
if (!(rh = rc_read_config(radiuscfg))) {
--
To view, visit https://gerrit.asterisk.org/4059
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic17c38de67583e971d78fe18807d1a9faf8f0afd
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Badalian Vyacheslav <v.badalyan at open-bs.ru>
More information about the asterisk-code-review
mailing list