Commit e853b6cc authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-5173 Cppcheck report

fixed bugs, found by cppcheck
parent 948056c5
......@@ -1616,7 +1616,7 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str,
enum enum_dyncol_func_result rc= ER_DYNCOL_RESOURCE;
size_t all_headers_size;
if (!(columns_order= malloc(sizeof(void*)*column_count)))
if (column_count && !(columns_order= malloc(sizeof(void*)*column_count)))
return ER_DYNCOL_RESOURCE;
if (new_str || str->str == 0)
{
......@@ -3959,7 +3959,7 @@ mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val)
{
sign= -1;
src++;
} else if (*src == '-')
} else if (*src == '+')
src++;
while(len && my_isdigit(&my_charset_latin1, *src))
{
......@@ -4032,7 +4032,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val)
case DYN_COL_STRING:
{
char *str, *end;
if ((str= malloc(val->x.string.value.length + 1)))
if (!(str= malloc(val->x.string.value.length + 1)))
return ER_DYNCOL_RESOURCE;
memcpy(str, val->x.string.value.str, val->x.string.value.length);
str[val->x.string.value.length]= '\0';
......
......@@ -95,7 +95,7 @@ public:
bool check_sort_buffer_properties(uint num_records, uint record_length)
{
return (static_cast<uint>(m_idx_array.size()) == num_records &&
m_record_length == m_record_length);
m_record_length == record_length);
}
/// Frees the buffer.
......
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