Commit 4368efe8 authored by Sergei Golubchik's avatar Sergei Golubchik

valgrind failures

and a couple of collaterals:
* debugging assert in my_valgrind.h
* trivial cleanup in sql_union.cc
parent e4f70789
......@@ -41,3 +41,5 @@
#define TRASH_FREE(A,B) TRASH_FILL(A,B,0x8F)
#define TRASH(A,B) TRASH_FREE(A,B)
# define DBUG_ASSERT_DEFINED(x) \
DBUG_ASSERT(!VALGRIND_CHECK_MEM_IS_DEFINED(&(x), sizeof(x)))
......@@ -333,7 +333,8 @@ char* Parser::read_and_decrypt_file(const char *secret)
// Check for file encryption
uchar *decrypted;
if (is_prefix((char*)buffer, OpenSSL_prefix))
if (file_size > OpenSSL_prefix_len &&
is_prefix((char*)buffer, OpenSSL_prefix))
{
uchar key[OpenSSL_key_len];
uchar iv[OpenSSL_iv_len];
......
......@@ -572,7 +572,7 @@ String *Item_func_decode_histogram::val_str(String *str)
uint i;
str->length(0);
char numbuf[32];
const uchar *p= (uchar*)res->c_ptr();
const uchar *p= (uchar*)res->c_ptr_safe();
for (i= 0; i < res->length(); i++)
{
double val;
......
......@@ -2648,7 +2648,7 @@ bool JOIN::make_aggr_tables_info()
*/
DBUG_PRINT("info",("Sorting for order by/group by"));
ORDER *order_arg= group_list ? group_list : order;
if (join_tab &&
if (top_join_tab_count + aggr_tables > const_tables &&
ordered_index_usage !=
(group_list ? ordered_index_group_by : ordered_index_order_by) &&
curr_tab->type != JT_CONST &&
......
......@@ -445,9 +445,10 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
bool is_union_select;
bool instantiate_tmp_table= false;
DBUG_ENTER("st_select_lex_unit::prepare");
DBUG_ASSERT(thd == thd_arg && thd == current_thd);
DBUG_ASSERT(thd == thd_arg);
DBUG_ASSERT(thd == current_thd);
describe= MY_TEST(additional_options & SELECT_DESCRIBE);
describe= additional_options & SELECT_DESCRIBE;
/*
Save fake_select_lex in case we don't need it for anything but
......
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