summaryrefslogtreecommitdiff
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorAutomerge script <automerge@asterisk.org>2012-11-08 18:19:49 +0000
committerAutomerge script <automerge@asterisk.org>2012-11-08 18:19:49 +0000
commitf69513b85b064ff1ff784b178035b37762cd047d (patch)
tree6316eb31b9f578d65b5cbb7d14a28ad29d4dccce /main/asterisk.c
parentf28061145f16d834d0ecee4d8c5bb605d957d7f8 (diff)
Merged revisions 376049 via svnmerge from
file:///srv/subversion/repos/asterisk/trunk ................ r376049 | rmudgett | 2012-11-08 11:38:31 -0600 (Thu, 08 Nov 2012) | 41 lines Add MALLOC_DEBUG enhancements. * Makes malloc() behave like calloc(). It will return a memory block filled with 0x55. A nonzero value. * Makes free() fill the released memory block and boundary fence's with 0xdeaddead. Any pointer use after free is going to have a pointer pointing to 0xdeaddead. The 0xdeaddead pointer is usually an invalid memory address so a crash is expected. * Puts the freed memory block into a circular array so it is not reused immediately. * When the circular array rotates out a memory block to the heap it checks that the memory has not been altered from 0xdeaddead. * Made the astmm_log message wording better. * Made crash if the DO_CRASH menuselect option is enabled and something is found. * Fixed a potential alignment issue on 64 bit systems. struct ast_region.data[] should now be aligned correctly for all platforms. * Extracted region_check_fences() from __ast_free_region() and handle_memory_show(). * Updated handle_memory_show() CLI usage help. Review: https://reviewboard.asterisk.org/r/2182/ ........ Merged revisions 376029 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376030 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376048 from http://svn.asterisk.org/svn/asterisk/branches/11 ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 80643b15a..b9e45d01d 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -3545,6 +3545,10 @@ int main(int argc, char *argv[])
int moduleresult; /*!< Result from the module load subsystem */
struct rlimit l;
+#if defined(__AST_DEBUG_MALLOC)
+ __ast_mm_init_phase_1();
+#endif /* defined(__AST_DEBUG_MALLOC) */
+
/* Remember original args for restart */
if (argc > ARRAY_LEN(_argv) - 1) {
fprintf(stderr, "Truncating argument size to %d\n", (int)ARRAY_LEN(_argv) - 1);
@@ -4231,9 +4235,9 @@ int main(int argc, char *argv[])
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
-#ifdef __AST_DEBUG_MALLOC
- __ast_mm_init();
-#endif
+#if defined(__AST_DEBUG_MALLOC)
+ __ast_mm_init_phase_2();
+#endif /* defined(__AST_DEBUG_MALLOC) */
ast_lastreloadtime = ast_startuptime = ast_tvnow();
ast_cli_register_multiple(cli_asterisk, ARRAY_LEN(cli_asterisk));