diff options
author | Daniel Black <daniel.black@au.ibm.com> | 2017-07-02 14:53:23 +1000 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2017-07-18 10:09:16 +0400 |
commit | c9883b75914d0ba4975aae0fbf8164f026e88559 (patch) | |
tree | a026584bb12180a8f19f779d114834c299dacc2c /storage | |
parent | 7d309b5f74982861efdfd069fd0e46c18d0cb7fe (diff) | |
download | mariadb-git-c9883b75914d0ba4975aae0fbf8164f026e88559.tar.gz |
ma_check/mi_check: maria_repair_parallel initialization for !quick
end_io_call uses uninitialized values from the new_data_cache
As such we the buffer 0 and check this before calling end_io_cache on it.
Thanks Sergey Vojtovich for the review and for this solution.
Found by Coverity (ref 972481).
Diffstat (limited to 'storage')
-rw-r--r-- | storage/maria/ma_check.c | 4 | ||||
-rw-r--r-- | storage/myisam/mi_check.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index fb35edc3be3..198df72a1d6 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -4250,6 +4250,8 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info, } */ DBUG_PRINT("info", ("is quick repair: %d", (int) rep_quick)); + if (!rep_quick) + my_b_clear(&new_data_cache); /* Initialize pthread structures before goto err. */ mysql_mutex_init(key_SORT_INFO_mutex, &sort_info.mutex, MY_MUTEX_INIT_FAST); @@ -4608,7 +4610,7 @@ err: already or they were not yet started (if the error happend before creating the threads). */ - if (!rep_quick) + if (!rep_quick && my_b_inited(&new_data_cache)) end_io_cache(&new_data_cache); if (!got_error) { diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index df97d6035d8..23e54966e2d 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -2676,6 +2676,8 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info, */ DBUG_PRINT("info", ("is quick repair: %d", rep_quick)); bzero((char*)&sort_info,sizeof(sort_info)); + if (!rep_quick) + my_b_clear(&new_data_cache); /* Initialize pthread structures before goto err. */ mysql_mutex_init(mi_key_mutex_MI_SORT_INFO_mutex, &sort_info.mutex, MY_MUTEX_INIT_FAST); @@ -3050,7 +3052,7 @@ err: already or they were not yet started (if the error happend before creating the threads). */ - if (!rep_quick) + if (!rep_quick && my_b_inited(&new_data_cache)) (void) end_io_cache(&new_data_cache); if (!got_error) { |