diff options
author | Monty <monty@mariadb.org> | 2020-06-24 12:51:55 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-06-24 12:51:55 +0300 |
commit | d1bb7f9143ceafe9cbdc1e53c4ffd4abe232cb97 (patch) | |
tree | 3efd42ce9b5cd9382e0cc6dd40b73d8052e76c1f | |
parent | d09dd5e86c1ce77cf00858fb5628c3745a1213a5 (diff) | |
download | mariadb-git-d1bb7f9143ceafe9cbdc1e53c4ffd4abe232cb97.tar.gz |
Fixed memory leak in item_sum.cc::report_cut_value_error()
Only affects DBUG builds
-rw-r--r-- | sql/item_sum.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e79344507b2..5573cc132f0 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3737,13 +3737,16 @@ static void report_cut_value_error(THD *thd, uint row_count, const char *fname) { size_t fn_len= strlen(fname); char *fname_upper= (char *) my_alloca(fn_len + 1); - fname_upper[fn_len]= 0; - for (; fn_len; fn_len--) - fname_upper[fn_len-1]= my_toupper(&my_charset_latin1, fname[fn_len-1]); + if (!fname_upper) + fname_upper= (char*) fname; // Out of memory + else + memcpy(fname_upper, fname, fn_len+1); + my_caseup_str(&my_charset_latin1, fname_upper); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_CUT_VALUE_GROUP_CONCAT, ER_THD(thd, ER_CUT_VALUE_GROUP_CONCAT), row_count, fname_upper); + my_afree(fname_upper); } |