MDEV-5173 Cppcheck report

fixed bugs, found by cppcheck
This commit is contained in:
Sergei Golubchik 2014-03-19 09:58:06 +01:00
parent 948056c535
commit e853b6ccfd
2 changed files with 4 additions and 4 deletions

View file

@ -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';

View file

@ -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.