Skip to content

Commit 6263b2e

Browse files
author
Robert Golebiowski
committed
Bug 22842590 - PB2 VALGRIND FAILURES FOR ENCRYPTION AND KEYRING TESTS - bug fix
1 parent 4b15ab7 commit 6263b2e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

plugin/keyring/buffer.h

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ struct Buffer
4343
DBUG_ASSERT(memory_size % sizeof(size_t) == 0); //make sure size is sizeof(size_t) aligned
4444
data= reinterpret_cast<uchar*>(new size_t[memory_size / sizeof(size_t)]);//force size_t alignment
4545
size= memory_size;
46+
if(data)
47+
memset(data, 0, size);
4648
position= 0;
4749
}
4850
uchar *data;

plugin/keyring/keyring.cc

+3
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ my_bool mysql_key_generate(const char *key_id, const char *key_type,
187187
boost::movelib::unique_ptr<IKey> key_candidate(new Key(key_id, key_type, user_id, NULL, 0));
188188

189189
boost::movelib::unique_ptr<uchar[]> key(new uchar[key_len]);
190+
if (key.get() == NULL)
191+
return TRUE;
192+
memset(key.get(), 0, key_len);
190193
if (is_keys_container_initialized == FALSE || check_key_for_writting(key_candidate.get(), "generating") ||
191194
my_rand_buffer(key.get(), key_len))
192195
return TRUE;

0 commit comments

Comments
 (0)