Commit c9883b75 authored by Daniel Black's avatar Daniel Black Committed by Sergey Vojtovich

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).
parent 7d309b5f
......@@ -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 @@ int maria_repair_parallel(HA_CHECK *param, register MARIA_HA *info,
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)
{
......
......@@ -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 @@ int mi_repair_parallel(HA_CHECK *param, register MI_INFO *info,
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)
{
......
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