Commit b201dcb5 authored by Bill King's avatar Bill King
Browse files

Fix issues in botan shown up by a coverity scan

Reviewed-by: kh
parent ed018f69
......@@ -180,7 +180,7 @@ void Pooling_Allocator::deallocate(void* ptr, u32bit n)
const u32bit BITMAP_SIZE = Memory_Block::bitmap_size();
const u32bit BLOCK_SIZE = Memory_Block::block_size();
if(ptr == 0 && n == 0)
if(ptr == 0 || n == 0)
return;
Mutex_Holder lock(mutex);
......
......@@ -103,8 +103,9 @@ EMSA2::EMSA2(HashFunction* hash_in) : hash(hash_in)
if(hash_id == 0)
{
std::string hashname = hash->name();
delete hash;
throw Encoding_Error("EMSA2 cannot be used with " + hash->name());
throw Encoding_Error("EMSA2 cannot be used with " + hashname);
}
}
......
......@@ -186,10 +186,11 @@ Randpool::Randpool(BlockCipher* cipher_in,
!cipher->valid_keylength(OUTPUT_LENGTH) ||
!mac->valid_keylength(OUTPUT_LENGTH))
{
std::string ciphername = cipher->name(), macname = mac->name();
delete cipher;
delete mac;
throw Internal_Error("Randpool: Invalid algorithm combination " +
cipher->name() + "/" + mac->name());
ciphername + "/" + macname);
}
buffer.create(BLOCK_SIZE);
......
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