Commit dd9d6756 authored by Michael Widenius's avatar Michael Widenius

When compiling with valgrind, change my_alloca() to use my_malloc()

- This allows us to detect missing my_afree() calls and also find overruns (when running with valgrind) to alloca() areas.
- Added missing my_afree() calls
- Fixed wrong call to my_afree()


include/my_sys.h:
  When compiling with valgrind, change my_alloca() to use my_malloc()
mysql-test/suite/innodb/t/innodb_bug57255.test:
  Speed up taste case (patch from Stewart Smith)
mysql-test/suite/innodb_plugin/t/innodb_bug57255.test:
  Speed up taste case (patch from Stewart Smith)
sql/ha_partition.cc:
  Removed casts from my_afree()
sql/opt_range.cc:
  Add missing my_afree() calls.
storage/maria/ma_rt_split.c:
  Fixed wrong parameter to my_afree()
parent a4ed89e3
...@@ -197,7 +197,7 @@ extern void my_large_free(uchar * ptr, myf my_flags); ...@@ -197,7 +197,7 @@ extern void my_large_free(uchar * ptr, myf my_flags);
#define my_large_free(A,B) my_free_lock((A),(B)) #define my_large_free(A,B) my_free_lock((A),(B))
#endif /* HAVE_LARGE_PAGES */ #endif /* HAVE_LARGE_PAGES */
#ifdef HAVE_ALLOCA #if defined(HAVE_ALLOCA) && !defined(HAVE_valgrind)
#if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43) #if defined(_AIX) && !defined(__GNUC__) && !defined(_AIX43)
#pragma alloca #pragma alloca
#endif /* _AIX */ #endif /* _AIX */
......
...@@ -12,6 +12,7 @@ create table C(id int not null auto_increment primary key, f1 int not null, fore ...@@ -12,6 +12,7 @@ create table C(id int not null auto_increment primary key, f1 int not null, fore
insert into A values(1), (2); insert into A values(1), (2);
--disable_query_log --disable_query_log
begin;
let $i=257; let $i=257;
while ($i) while ($i)
{ {
...@@ -24,6 +25,7 @@ while ($i) ...@@ -24,6 +25,7 @@ while ($i)
insert into C(f1) values(2); insert into C(f1) values(2);
dec $i; dec $i;
} }
commit;
--enable_query_log --enable_query_log
# Following Deletes should not report error # Following Deletes should not report error
......
...@@ -12,6 +12,7 @@ create table C(id int not null auto_increment primary key, f1 int not null, fore ...@@ -12,6 +12,7 @@ create table C(id int not null auto_increment primary key, f1 int not null, fore
insert into A values(1), (2); insert into A values(1), (2);
--disable_query_log --disable_query_log
begin;
let $i=257; let $i=257;
while ($i) while ($i)
{ {
...@@ -24,6 +25,7 @@ while ($i) ...@@ -24,6 +25,7 @@ while ($i)
insert into C(f1) values(2); insert into C(f1) values(2);
dec $i; dec $i;
} }
commit;
--enable_query_log --enable_query_log
# Following Deletes should not report error # Following Deletes should not report error
......
...@@ -2432,7 +2432,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root) ...@@ -2432,7 +2432,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
for (i= 0; i < m_tot_parts; i++) for (i= 0; i < m_tot_parts; i++)
m_engine_array[i]= ha_lock_engine(NULL, engine_array[i]); m_engine_array[i]= ha_lock_engine(NULL, engine_array[i]);
my_afree((gptr) engine_array); my_afree(engine_array);
if (!m_file && create_handlers(mem_root)) if (!m_file && create_handlers(mem_root))
{ {
...@@ -2442,7 +2442,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root) ...@@ -2442,7 +2442,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
err3: err3:
my_afree((gptr) engine_array); my_afree(engine_array);
err2: err2:
my_free(file_buffer, MYF(0)); my_free(file_buffer, MYF(0));
err1: err1:
......
...@@ -11058,6 +11058,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() ...@@ -11058,6 +11058,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range()
/* Compare the found key with max_key. */ /* Compare the found key with max_key. */
int cmp_res= key_cmp(index_info->key_part, max_key, int cmp_res= key_cmp(index_info->key_part, max_key,
real_prefix_len + min_max_arg_len); real_prefix_len + min_max_arg_len);
my_afree(max_key);
/* /*
The key is outside of the range if: The key is outside of the range if:
the interval is open and the key is equal to the maximum boundry the interval is open and the key is equal to the maximum boundry
...@@ -11183,6 +11184,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() ...@@ -11183,6 +11184,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range()
/* Compare the found key with min_key. */ /* Compare the found key with min_key. */
int cmp_res= key_cmp(index_info->key_part, min_key, int cmp_res= key_cmp(index_info->key_part, min_key,
real_prefix_len + min_max_arg_len); real_prefix_len + min_max_arg_len);
my_afree(min_key);
/* /*
The key is outside of the range if: The key is outside of the range if:
the interval is open and the key is equal to the minimum boundry the interval is open and the key is equal to the minimum boundry
......
...@@ -544,8 +544,7 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page, ...@@ -544,8 +544,7 @@ int maria_rtree_split_page(const MARIA_KEY *key, MARIA_PAGE *page,
} }
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs)); DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
my_afree(new_page); my_afree(new_page_buff);
split_err: split_err:
my_afree(coord_buf); my_afree(coord_buf);
DBUG_RETURN(err_code); DBUG_RETURN(err_code);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment