diff options
author | Michael Widenius <monty@askmonty.org> | 2010-08-02 12:01:24 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-08-02 12:01:24 +0300 |
commit | e0a6b02c5d0a311e7167295494786077009743d1 (patch) | |
tree | 72c934fe42261ad5de3139961e092f57e9d147df /mysys/my_alloc.c | |
parent | d2f8b7d04503478ab6b6998194a2070891f0c2bb (diff) | |
parent | 6ad06b15222300e4eed4fe3972d1ad249c4c42a2 (diff) | |
download | mariadb-git-e0a6b02c5d0a311e7167295494786077009743d1.tar.gz |
Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
Diffstat (limited to 'mysys/my_alloc.c')
-rw-r--r-- | mysys/my_alloc.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index 8d3bc0c3fb2..948d3a8476d 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -153,6 +153,14 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) DBUG_ASSERT(alloc_root_inited(mem_root)); + DBUG_EXECUTE_IF("simulate_out_of_memory", + { + if (mem_root->error_handler) + (*mem_root->error_handler)(); + DBUG_SET("-d,simulate_out_of_memory"); + DBUG_RETURN((void*) 0); /* purecov: inspected */ + }); + length+=ALIGN_SIZE(sizeof(USED_MEM)); if (!(next = (USED_MEM*) my_malloc(length,MYF(MY_WME)))) { @@ -175,6 +183,14 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) DBUG_PRINT("enter",("root: 0x%lx", (long) mem_root)); DBUG_ASSERT(alloc_root_inited(mem_root)); + DBUG_EXECUTE_IF("simulate_out_of_memory", + { + /* Avoid reusing an already allocated block */ + if (mem_root->error_handler) + (*mem_root->error_handler)(); + DBUG_SET("-d,simulate_out_of_memory"); + DBUG_RETURN((void*) 0); /* purecov: inspected */ + }); length= ALIGN_SIZE(length); if ((*(prev= &mem_root->free)) != NULL) { @@ -275,7 +291,7 @@ void *multi_alloc_root(MEM_ROOT *root, ...) DBUG_RETURN((void*) start); } -#define TRASH_MEM(X) VALGRIND_MAKE_MEM_UNDEFINED(((char*)(X) + ((X)->size-(X)->left)), (X)->left) +#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left) /* Mark all data in blocks free for reusage */ |