[Home]

Summary:ASTERISK-22560: Memory leak in logger.c
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2013-09-19 20:39:32Date Closed:2013-09-20 09:28:03
Priority:BlockerRegression?
Status:Closed/CompleteComponents:Core/Logging
Versions:11.6.0 Frequency of
Occurrence
Related
Issues:
must be completed before resolvingASTERISK-22562 Open blockers for 11.6.0
is caused byASTERISK-22450 No CLI response from database show
is related toASTERISK-22540 WARNING[2324] asterisk.c: Fork failed: Cannot allocate memory in /var/log/asterisk/messages then segfault
Environment:Attachments:
Description:A memory leak in {{logger.c}} snuck in as part of r399269. This was pointed out by John Hardin of Digium along with the patch that fixes it:

{noformat}
Index: main/logger.c
===================================================================
--- main/logger.c (revision 399497)
+++ main/logger.c (working copy)
@@ -1632,6 +1632,7 @@
res = ast_str_set_va(&buf, 0, fmt, ap);
/* If the build failed then we can drop this allocated message */
if (res == AST_DYNSTR_BUILD_FAILED) {
+ ast_free(buf);
return;
}

@@ -1659,6 +1660,7 @@
} while (p && *p);

ast_log_callid(__LOG_VERBOSE, file, line, func, callid, "%s", ast_str_buffer(prefixed));
+ ast_free (buf);
}

void __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt, ...)
{noformat}
Comments:By: Matt Jordan (mjordan) 2013-10-18 11:00:12.054-0500

Note that this was fixed in r399513