diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-03-19 09:58:06 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-03-19 09:58:06 +0100 |
commit | e853b6ccfda237157f3fe78afe7fbfe048bd76a0 (patch) | |
tree | cf83abbc0c88b232bc743fecf7f4f7b60ef07465 | |
parent | 948056c535001b1462becb2b27d16ab1a40bcc49 (diff) | |
download | mariadb-git-e853b6ccfda237157f3fe78afe7fbfe048bd76a0.tar.gz |
MDEV-5173 Cppcheck report
fixed bugs, found by cppcheck
-rw-r--r-- | mysys/ma_dyncol.c | 6 | ||||
-rw-r--r-- | sql/filesort_utils.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 7a7459673f5..98319f2aafe 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -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'; diff --git a/sql/filesort_utils.h b/sql/filesort_utils.h index 4cccf8ffa02..00fa6f2566b 100644 --- a/sql/filesort_utils.h +++ b/sql/filesort_utils.h @@ -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. |