Index: include/asterisk/strings.h =================================================================== --- include/asterisk/strings.h (revision 180844) +++ include/asterisk/strings.h (working copy) @@ -665,8 +665,14 @@ * through calling one of the other functions or macros defined in this * file. */ +#if (defined(MALLOC_DEBUG) && !defined(STANDALONE)) +int __attribute__((format(printf, 4, 0))) __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 *func); +#define __ast_str_helper(a,b,c,d,e) __ast_debug_str_helper(a,b,c,d,e,__FILE__,__LINE__,__PRETTY_FUNCTION__) +#else int __attribute__((format(printf, 4, 0))) __ast_str_helper(struct ast_str **buf, size_t max_len, int append, const char *fmt, va_list ap); +#endif char *__ast_str_helper2(struct ast_str **buf, size_t max_len, const char *src, size_t maxsrc, int append, int escapecommas); Index: main/strings.c =================================================================== --- main/strings.c (revision 180844) +++ main/strings.c (working copy) @@ -48,8 +48,13 @@ * 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 @@ 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; }