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

MDEV-12253 post-fix: Do not leak memory in crash recovery

This is a backport from 10.2 where it fixes the
cmake -DWITH_ASAN test failure that was mentioned
in commit f9cc3918
(merging MDEV-12253 from 10.1 to 10.2).

fil_parse_write_crypt_data(): If the tablespace is not found,
invoke fil_space_destroy_crypt_data(&crypt_data) to properly
free the created object.
parent 9d2c1d09
......@@ -537,16 +537,16 @@ fil_parse_write_crypt_data(
ptr += len;
/* update fil_space memory cache with crypt_data */
fil_space_t* space = fil_space_acquire_silent(space_id);
if (space) {
if (fil_space_t* space = fil_space_acquire_silent(space_id)) {
crypt_data = fil_space_set_crypt_data(space, crypt_data);
fil_space_release(space);
}
/* Check is used key found from encryption plugin */
if (crypt_data->should_encrypt() && !crypt_data->is_key_found()) {
*err = DB_DECRYPTION_FAILED;
/* Check is used key found from encryption plugin */
if (crypt_data->should_encrypt()
&& !crypt_data->is_key_found()) {
*err = DB_DECRYPTION_FAILED;
}
} else {
fil_space_destroy_crypt_data(&crypt_data);
}
return ptr;
......
......@@ -537,16 +537,16 @@ fil_parse_write_crypt_data(
ptr += len;
/* update fil_space memory cache with crypt_data */
fil_space_t* space = fil_space_acquire_silent(space_id);
if (space) {
if (fil_space_t* space = fil_space_acquire_silent(space_id)) {
crypt_data = fil_space_set_crypt_data(space, crypt_data);
fil_space_release(space);
}
/* Check is used key found from encryption plugin */
if (crypt_data->should_encrypt() && !crypt_data->is_key_found()) {
*err = DB_DECRYPTION_FAILED;
/* Check is used key found from encryption plugin */
if (crypt_data->should_encrypt()
&& !crypt_data->is_key_found()) {
*err = DB_DECRYPTION_FAILED;
}
} else {
fil_space_destroy_crypt_data(&crypt_data);
}
return ptr;
......
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