[asterisk-commits] logging,cdr,cel: Fix stringfield memory leak. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 1 16:11:33 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: logging,cdr,cel: Fix stringfield memory leak.
......................................................................


logging,cdr,cel: Fix stringfield memory leak.

The stringfields refactor to allow adding stringfields to the end of a
structure (f6f4cf459f43f072604927209b39646f84aaa2e2) exposed some
incomplete cleanup code by some stringfield users.

The most noticeable leaker is the logging system where there is a leak for
every log message generated.

ASTERISK-26078 #close
Reported by:  Etienne Lessard
Patches:
      jira_asterisk_26078_v13.patch (license #5621) patch uploaded
      by Richard Mudgett

Change-Id: If6a08b31336b492c3de6f9dfd07c447f8d5a8782
---
M cdr/cdr_custom.c
M cdr/cdr_syslog.c
M cel/cel_custom.c
M main/logger.c
4 files changed, 7 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved
  Corey Farrell: Looks good to me, but someone else must approve



diff --git a/cdr/cdr_custom.c b/cdr/cdr_custom.c
index df76363..6ef2cb0 100644
--- a/cdr/cdr_custom.c
+++ b/cdr/cdr_custom.c
@@ -81,8 +81,10 @@
 static void free_config(void)
 {
 	struct cdr_custom_config *sink;
+
 	while ((sink = AST_RWLIST_REMOVE_HEAD(&sinks, list))) {
 		ast_mutex_destroy(&sink->lock);
+		ast_string_field_free_memory(sink);
 		ast_free(sink);
 	}
 }
diff --git a/cdr/cdr_syslog.c b/cdr/cdr_syslog.c
index 458721a..c1169a3 100644
--- a/cdr/cdr_syslog.c
+++ b/cdr/cdr_syslog.c
@@ -76,8 +76,10 @@
 static void free_config(void)
 {
 	struct cdr_syslog_config *sink;
+
 	while ((sink = AST_RWLIST_REMOVE_HEAD(&sinks, list))) {
 		ast_mutex_destroy(&sink->lock);
+		ast_string_field_free_memory(sink);
 		ast_free(sink);
 	}
 }
diff --git a/cel/cel_custom.c b/cel/cel_custom.c
index edb0096..0b2ac76 100644
--- a/cel/cel_custom.c
+++ b/cel/cel_custom.c
@@ -71,8 +71,10 @@
 static void free_config(void)
 {
 	struct cel_config *sink;
+
 	while ((sink = AST_RWLIST_REMOVE_HEAD(&sinks, list))) {
 		ast_mutex_destroy(&sink->lock);
+		ast_string_field_free_memory(sink);
 		ast_free(sink);
 	}
 }
diff --git a/main/logger.c b/main/logger.c
index 9f03b4e..a70b6d1 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -168,6 +168,7 @@
 	if (msg->callid) {
 		ast_callid_unref(msg->callid);
 	}
+	ast_string_field_free_memory(msg);
 	ast_free(msg);
 }
 

-- 
To view, visit https://gerrit.asterisk.org/2927
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If6a08b31336b492c3de6f9dfd07c447f8d5a8782
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list