aboutsummaryrefslogtreecommitdiffstats
path: root/main/chanvars.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-14 22:38:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-14 22:38:06 +0000
commit6c7d8c95dfe56152ca00cde4c7c59496b513af6a (patch)
tree96325674713833036b2bd7758905df5ccb47ca65 /main/chanvars.c
parentd12237922aaa9e2273879e19453efd59a04d2503 (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/chanvars.c')
-rw-r--r--main/chanvars.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main/chanvars.c b/main/chanvars.c
index 14a89f767..670858937 100644
--- a/main/chanvars.c
+++ b/main/chanvars.c
@@ -31,13 +31,21 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/strings.h"
#include "asterisk/utils.h"
+#ifdef MALLOC_DEBUG
+struct ast_var_t *_ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function)
+#else
struct ast_var_t *ast_var_assign(const char *name, const char *value)
+#endif
{
struct ast_var_t *var;
int name_len = strlen(name) + 1;
int value_len = strlen(value) + 1;
+#ifdef MALLOC_DEBUG
+ if (!(var = __ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char), file, lineno, function))) {
+#else
if (!(var = ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char)))) {
+#endif
return NULL;
}