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
........

Merged revisions 399513 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@399514 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin Harwell
2013-09-20 14:25:32 +00:00
parent cf9356e189
commit d7dcb9ce19

View File

@@ -1632,6 +1632,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); res = ast_str_set_va(&buf, 0, fmt, ap);
/* If the build failed then we can drop this allocated message */ /* If the build failed then we can drop this allocated message */
if (res == AST_DYNSTR_BUILD_FAILED) { if (res == AST_DYNSTR_BUILD_FAILED) {
ast_free(buf);
return; return;
} }
@@ -1659,6 +1660,7 @@ void __ast_verbose_ap(const char *file, int line, const char *func, int level, s
} while (p && *p); } while (p && *p);
ast_log_callid(__LOG_VERBOSE, file, line, func, callid, "%s", ast_str_buffer(prefixed)); 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, ...) void __ast_verbose(const char *file, int line, const char *func, int level, const char *fmt, ...)