logging,cdr,cel: Fix stringfield memory leak.

The stringfields refactor to allow adding stringfields to the end of a
structure (f6f4cf459f) 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
This commit is contained in:
Richard Mudgett 2016-06-01 13:57:53 -05:00
parent 608e0267e8
commit 40d19f2e55
4 changed files with 7 additions and 0 deletions

View 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);
}
}

View 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);
}
}

View 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);
}
}

View File

@ -174,6 +174,7 @@ struct logmsg {
static void logmsg_free(struct logmsg *msg)
{
ast_string_field_free_memory(msg);
ast_free(msg);
}