From: Kevin Harwell Date: Fri, 20 Sep 2013 14:23:30 +0000 (+0000) Subject: Fix memory leak in logger. X-Git-Tag: 11.7.0-rc1~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44f616bd2e5ca84a923f239943dce8214c647014;p=thirdparty%2Fasterisk.git Fix memory leak in logger. Fixed a memory leak discovered in the logger where a temporary string buffer was not being freed. (closes issue ASTERISK-22540) Reported by: John Hardin git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@399513 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/logger.c b/main/logger.c index 3f9209af52..77107bf661 100644 --- a/main/logger.c +++ b/main/logger.c @@ -1811,6 +1811,7 @@ void __ast_verbose_ap(const char *file, int line, const char *func, int level, s 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; } @@ -1838,6 +1839,7 @@ void __ast_verbose_ap(const char *file, int line, const char *func, int level, s } 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, ...)