diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-11 00:29:59 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-03-11 00:29:59 +0000 |
commit | a914fe05112d518c6abfbc042ae593386ff3d219 (patch) | |
tree | d9ce0c66f8edace25beb5e6d7b7032155aa9d5fc /main/strings.c | |
parent | 78ae84644006651127e72a2b8a8e79a2b85a61db (diff) |
Add MALLOC_DEBUG to various utility APIs, so that memory leaks can be tracked back to their source.
(related to issue #14636)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@181028 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/strings.c')
-rw-r--r-- | main/strings.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/main/strings.c b/main/strings.c index 5547e54a9..88c240ff5 100644 --- a/main/strings.c +++ b/main/strings.c @@ -48,8 +48,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * ast_str_append_va(...) */ +#if (defined(MALLOC_DEBUG) && !defined(STANDALONE)) +int __ast_debug_str_helper(struct ast_str **buf, size_t max_len, + int append, const char *fmt, va_list ap, const char *file, int lineno, const char *function) +#else int __ast_str_helper(struct ast_str **buf, size_t max_len, int append, const char *fmt, va_list ap) +#endif { int res, need; int offset = (append && (*buf)->__AST_STR_LEN) ? (*buf)->__AST_STR_USED : 0; @@ -80,7 +85,13 @@ int __ast_str_helper(struct ast_str **buf, size_t max_len, if (0) { /* debugging */ ast_verbose("extend from %d to %d\n", (int)(*buf)->__AST_STR_LEN, need); } - if (ast_str_make_space(buf, need)) { + if ( +#if (defined(MALLOC_DEBUG) && !defined(STANDALONE)) + _ast_str_make_space(buf, need, file, lineno, function) +#else + ast_str_make_space(buf, need) +#endif + ) { ast_verbose("failed to extend from %d to %d\n", (int)(*buf)->__AST_STR_LEN, need); return AST_DYNSTR_BUILD_FAILED; } |