]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
logging,cdr,cel: Fix stringfield memory leak. 27/2927/1
authorRichard Mudgett <rmudgett@digium.com>
Wed, 1 Jun 2016 18:57:53 +0000 (13:57 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Wed, 1 Jun 2016 18:57:53 +0000 (13:57 -0500)
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

cdr/cdr_custom.c
cdr/cdr_syslog.c
cel/cel_custom.c
main/logger.c

index df763639fa8cb8277727636558fc47cda6c7b9c2..6ef2cb094e3919d86d22a820c74e7e495be21f07 100644 (file)
@@ -81,8 +81,10 @@ static AST_RWLIST_HEAD_STATIC(sinks, cdr_custom_config);
 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);
        }
 }
index 458721aa832213c77eeb8657f488f79d55badb0e..c1169a35c50f32481c40188844db4778d5df4c6f 100644 (file)
@@ -76,8 +76,10 @@ static AST_RWLIST_HEAD_STATIC(sinks, cdr_syslog_config);
 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);
        }
 }
index edb009686ec38d0de9ea2f1db58abe606ae397a2..0b2ac764f75e65bfa3fbab8cc7eb47ebe853ac8c 100644 (file)
@@ -71,8 +71,10 @@ static AST_RWLIST_HEAD_STATIC(sinks, cel_config);
 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);
        }
 }
index 9f03b4efa3a1847fdfb469afabb2f21784e5c739..a70b6d15eb3279441d30af55787c2d7c377060e9 100644 (file)
@@ -168,6 +168,7 @@ static void logmsg_free(struct logmsg *msg)
        if (msg->callid) {
                ast_callid_unref(msg->callid);
        }
+       ast_string_field_free_memory(msg);
        ast_free(msg);
 }