]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
logging,cdr,cel: Fix stringfield memory leak. 28/2928/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 19:09:36 +0000 (14:09 -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 24cb834f69966ea3e3bf5d200483cf086117dff6..bb63ea0c646b5569805603d50194ed35dc0826a0 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 85860ececdcbbede4e4bc53bc2b3a6c84293953b..39f115920dc4a485b8b52330944c4c4f454d57b6 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 f6377fcd71b81ddc27e74a7991c4d65b2d0ea920..f75efdd4be46303af9362ef17f6642b6401dc047 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 ae1e0bd8d1829e5c20a17671e82c9765566afe6d..9a16dcf13bcc7c9c93134c7175cbab54d3c4249f 100644 (file)
@@ -174,6 +174,7 @@ struct logmsg {
 
 static void logmsg_free(struct logmsg *msg)
 {
+       ast_string_field_free_memory(msg);
        ast_free(msg);
 }