Commit bbb3fb31 authored by Marko Mäkelä's avatar Marko Mäkelä

Follow-up for MDEV-11630 Call mutex_free() before freeing the mutex list

fil_tablespace_iterate(): Call fil_space_destroy_crypt_data() to
invoke mutex_free() for the mutex_create() that was done in
fil_space_read_crypt_data(). Also, remember to free
iter.crypt_io_buffer.

The failure to call mutex_free() would cause sync_latch_meta_destroy()
to access freed memory on shutdown. This affected the IMPORT of
encrypted tablespaces.
parent 08f79bde
......@@ -6685,18 +6685,18 @@ fil_tablespace_iterate(
iter.io_buffer = static_cast<byte*>(
ut_align(io_buffer, UNIV_PAGE_SIZE));
/** Add an exta buffer for encryption */
void* crypt_io_buffer = NULL;
if (iter.crypt_data != NULL) {
crypt_io_buffer = ut_malloc_nokey(
iter.n_io_buffers * UNIV_PAGE_SIZE);
iter.crypt_io_buffer = static_cast<byte*>(
crypt_io_buffer);
}
iter.crypt_io_buffer = iter.crypt_data
? static_cast<byte*>(
ut_malloc_nokey(iter.n_io_buffers
* UNIV_PAGE_SIZE))
: NULL;
err = fil_iterate(iter, block, callback);
ut_free(io_buffer);
ut_free(iter.crypt_io_buffer);
fil_space_destroy_crypt_data(&iter.crypt_data);
}
}
......
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