diff options
author | unknown <sanja@askmonty.org> | 2013-09-11 18:14:36 +0300 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2013-09-11 18:14:36 +0300 |
commit | 232eb75b67bc6243d499b1fa78e3d92829897593 (patch) | |
tree | a63015052a054d54ca25058f6734e4a59f7fed09 /mysys/ma_dyncol.c | |
parent | edc1e91913b29c95d5c95e5cdd8dc71f6625cfd9 (diff) | |
download | mariadb-git-232eb75b67bc6243d499b1fa78e3d92829897593.tar.gz |
MDEV-4994: Crash in dynamic column API
Dynamic columns unittest fix.
Correct processing of empty string added to creation dynamic string procedure
List function of numeric format fixed when empty string passed.
Unit test calls changed to new ones.
Unit test added to cmake file.
Diffstat (limited to 'mysys/ma_dyncol.c')
-rw-r--r-- | mysys/ma_dyncol.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 1d297d918da..d1a59a343df 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -1618,15 +1618,22 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, if (!(columns_order= malloc(sizeof(void*)*column_count))) return ER_DYNCOL_RESOURCE; - if (new_str) + if (new_str || str->str == 0) { - if (dynamic_column_init_named(str, - fmt->fixed_hdr + - hdr->header_size + - hdr->nmpool_size + - hdr->data_size + - DYNCOL_SYZERESERVE)) - goto err; + if (column_count) + { + if (dynamic_column_init_named(str, + fmt->fixed_hdr + + hdr->header_size + + hdr->nmpool_size + + hdr->data_size + + DYNCOL_SYZERESERVE)) + goto err; + } + else + { + dynamic_column_initialize(str); + } } else { @@ -2438,7 +2445,8 @@ mariadb_dyncol_list(DYNAMIC_COLUMN *str, uint *count, uint **nums) uint i; enum enum_dyncol_func_result rc; - (*nums)= 0; /* In case of errors */ + (*nums)= 0; (*count)= 0; /* In case of errors */ + if (str->length == 0) return ER_DYNCOL_OK; /* no columns */ |