summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-06-24 12:51:55 +0300
committerMonty <monty@mariadb.org>2020-06-24 12:51:55 +0300
commitd1bb7f9143ceafe9cbdc1e53c4ffd4abe232cb97 (patch)
tree3efd42ce9b5cd9382e0cc6dd40b73d8052e76c1f
parentd09dd5e86c1ce77cf00858fb5628c3745a1213a5 (diff)
downloadmariadb-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.cc9
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);
}