Free new[]'d array using delete[] instead of free in speed.cc.
Change-Id: Ic3d5e8de0b6800c0852c2057427836302c1f1aaa Reviewed-on: https://boringssl-review.googlesource.com/3962 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
a42b4163f8
commit
1d1562d9b5
@ -166,13 +166,6 @@ static bool SpeedRSA(const std::string& key_name, RSA *key) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
struct free_functor {
|
|
||||||
void operator()(T* ptr) {
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static uint8_t *align(uint8_t *in, unsigned alignment) {
|
static uint8_t *align(uint8_t *in, unsigned alignment) {
|
||||||
return reinterpret_cast<uint8_t *>(
|
return reinterpret_cast<uint8_t *>(
|
||||||
(reinterpret_cast<uintptr_t>(in) + alignment) &
|
(reinterpret_cast<uintptr_t>(in) + alignment) &
|
||||||
@ -192,10 +185,8 @@ static bool SpeedAEADChunk(const EVP_AEAD *aead, const std::string &name,
|
|||||||
memset(key.get(), 0, key_len);
|
memset(key.get(), 0, key_len);
|
||||||
std::unique_ptr<uint8_t[]> nonce(new uint8_t[nonce_len]);
|
std::unique_ptr<uint8_t[]> nonce(new uint8_t[nonce_len]);
|
||||||
memset(nonce.get(), 0, nonce_len);
|
memset(nonce.get(), 0, nonce_len);
|
||||||
std::unique_ptr<uint8_t, free_functor<uint8_t>> in_storage(
|
std::unique_ptr<uint8_t[]> in_storage(new uint8_t[chunk_len + kAlignment]);
|
||||||
new uint8_t[chunk_len + kAlignment]);
|
std::unique_ptr<uint8_t[]> out_storage(new uint8_t[chunk_len + overhead_len + kAlignment]);
|
||||||
std::unique_ptr<uint8_t, free_functor<uint8_t>> out_storage(
|
|
||||||
new uint8_t[chunk_len + overhead_len + kAlignment]);
|
|
||||||
std::unique_ptr<uint8_t[]> ad(new uint8_t[ad_len]);
|
std::unique_ptr<uint8_t[]> ad(new uint8_t[ad_len]);
|
||||||
memset(ad.get(), 0, ad_len);
|
memset(ad.get(), 0, ad_len);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user