diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-10-14 22:38:06 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-10-14 22:38:06 +0000 |
commit | 6c7d8c95dfe56152ca00cde4c7c59496b513af6a (patch) | |
tree | 96325674713833036b2bd7758905df5ccb47ca65 /main/config.c | |
parent | d12237922aaa9e2273879e19453efd59a04d2503 (diff) |
Add additional memory debugging to several core APIs, and fix several memory
leaks found with these changes.
(Closes issue #13505, closes issue #13543)
Reported by: mav3rick, triccyx
Patches:
20081001__bug13505.diff.txt uploaded by Corydon76 (license 14)
Tested by: mav3rick, triccyx
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@149199 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/config.c')
-rw-r--r-- | main/config.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/config.c b/main/config.c index 986c81571..2055af396 100644 --- a/main/config.c +++ b/main/config.c @@ -230,14 +230,22 @@ struct ast_config_include { 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; |