]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Memory leak in logger.
authorKevin Harwell <kharwell@digium.com>
Fri, 20 Sep 2013 14:31:59 +0000 (14:31 +0000)
committerKevin Harwell <kharwell@digium.com>
Fri, 20 Sep 2013 14:31:59 +0000 (14:31 +0000)
Fixed a memory leak discovered in the logger where a temporary string buffer
was not being freed.

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/certified/branches/11.2@399516 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/logger.c

index 83868350087714c5052f951fafaaf58134d50ced..eb198d22fbb1eea205758ac3aa2f7523f4ed1ee7 100644 (file)
@@ -1758,6 +1758,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;
        }
 
@@ -1785,6 +1786,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, ...)