Index: include/asterisk/config.h =================================================================== --- include/asterisk/config.h (revision 143334) +++ include/asterisk/config.h (working copy) @@ -334,7 +334,12 @@ struct ast_variable *ast_category_detach_variables(struct ast_category *cat); void ast_category_rename(struct ast_category *cat, const char *name); +#ifdef MALLOC_DEBUG +struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *function, int lineno); +#define ast_variable_new(a, b, c) _ast_variable_new(a, b, c, __FILE__, __PRETTY_FUNCTION__, __LINE__) +#else struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename); +#endif struct ast_config_include *ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size); struct ast_config_include *ast_include_find(struct ast_config *conf, const char *included_file); void ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file); Index: main/config.c =================================================================== --- main/config.c (revision 143334) +++ main/config.c (working copy) @@ -230,14 +230,22 @@ struct ast_config_include *next; /*!< ptr to next inclusion in the list */ }; +#ifdef MALLOC_DEBUG +struct ast_variable *_ast_variable_new(const char *name, const char *value, const char *filename, const char *file, const char *func, int lineno) +#else struct ast_variable *ast_variable_new(const char *name, const char *value, const char *filename) +#endif { struct ast_variable *variable; int name_len = strlen(name) + 1; int val_len = strlen(value) + 1; int fn_len = strlen(filename) + 1; +#ifdef MALLOC_DEBUG + if ((variable = __ast_calloc(1, name_len + val_len + fn_len + sizeof(*variable), file, lineno, func))) { +#else if ((variable = ast_calloc(1, name_len + val_len + fn_len + sizeof(*variable)))) { +#endif char *dst = variable->stuff; /* writable space starts here */ variable->name = strcpy(dst, name); dst += name_len;