diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-01-15 20:58:24 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-01-15 20:58:24 +0000 |
commit | 36ba567f703701abe0381d8032b6112a499d992e (patch) | |
tree | 8356b9adce51893db63014d6df309c0b71ff98e1 /main/utils.c | |
parent | 345626e641147e7954ce4444d5df5f359aceaaac (diff) |
Make sure to set owner_line, ownder_func, and owner_file in ast_calloc_with_stringfields.
Asterisk would crash on startup if MALLOC_DEBUG were set in menuselect. This is because
the manager action UpdateConfig had to resize its string field allocation to set the
description. When the resize occurred, ast_copy_string would crash because we were
attempting to copy a string from a NULL pointer. Setting the strings initially makes
the code much less crashy.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@240420 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/utils.c')
-rw-r--r-- | main/utils.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c index e900f7be2..86dcb0428 100644 --- a/main/utils.c +++ b/main/utils.c @@ -1792,6 +1792,11 @@ void *__ast_calloc_with_stringfields(unsigned int num_structs, size_t struct_siz mgr->embedded_pool = pool; *pool_head = pool; pool->size = size_to_alloc - struct_size - sizeof(*pool); +#if defined(__AST_DEBUG_MALLOC) + mgr->owner_file = file; + mgr->owner_func = func; + mgr->owner_line = lineno; +#endif } return allocation; |