forked from qt-creator/qt-creator
Fix issues in botan shown up by a coverity scan
Reviewed-by: kh
This commit is contained in:
@@ -180,7 +180,7 @@ void Pooling_Allocator::deallocate(void* ptr, u32bit n)
|
|||||||
const u32bit BITMAP_SIZE = Memory_Block::bitmap_size();
|
const u32bit BITMAP_SIZE = Memory_Block::bitmap_size();
|
||||||
const u32bit BLOCK_SIZE = Memory_Block::block_size();
|
const u32bit BLOCK_SIZE = Memory_Block::block_size();
|
||||||
|
|
||||||
if(ptr == 0 && n == 0)
|
if(ptr == 0 || n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Mutex_Holder lock(mutex);
|
Mutex_Holder lock(mutex);
|
||||||
|
@@ -103,8 +103,9 @@ EMSA2::EMSA2(HashFunction* hash_in) : hash(hash_in)
|
|||||||
|
|
||||||
if(hash_id == 0)
|
if(hash_id == 0)
|
||||||
{
|
{
|
||||||
|
std::string hashname = hash->name();
|
||||||
delete hash;
|
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) ||
|
!cipher->valid_keylength(OUTPUT_LENGTH) ||
|
||||||
!mac->valid_keylength(OUTPUT_LENGTH))
|
!mac->valid_keylength(OUTPUT_LENGTH))
|
||||||
{
|
{
|
||||||
|
std::string ciphername = cipher->name(), macname = mac->name();
|
||||||
delete cipher;
|
delete cipher;
|
||||||
delete mac;
|
delete mac;
|
||||||
throw Internal_Error("Randpool: Invalid algorithm combination " +
|
throw Internal_Error("Randpool: Invalid algorithm combination " +
|
||||||
cipher->name() + "/" + mac->name());
|
ciphername + "/" + macname);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.create(BLOCK_SIZE);
|
buffer.create(BLOCK_SIZE);
|
||||||
|
Reference in New Issue
Block a user