mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 15:35:49 -04:00
added checks after mallocs in several files
This commit is contained in:
parent
46520b0e22
commit
9c6e7dfc13
15 changed files with 157 additions and 12 deletions
|
@ -100,6 +100,13 @@ int bloomFilter::setFilterBits(const std::string &hex)
|
|||
|
||||
// convert to binary array.
|
||||
uint8_t *tmparray = (uint8_t *) malloc(bytes);
|
||||
|
||||
if(tmparray == NULL)
|
||||
{
|
||||
std::cerr << "(EE) Error. Cannot allocate memory for " << bytes << " bytes in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
|
||||
for(i = 0; i < bytes; i++)
|
||||
|
@ -139,6 +146,13 @@ std::string bloomFilter::getFilter()
|
|||
|
||||
// convert to binary array.
|
||||
uint8_t *tmparray = (uint8_t *) malloc(bytes);
|
||||
|
||||
if(tmparray == NULL)
|
||||
{
|
||||
std::cerr << "(EE) Error. Cannot allocate memory for " << bytes << " bytes in " << __PRETTY_FUNCTION__ << std::endl;
|
||||
return std::string();
|
||||
}
|
||||
|
||||
int i,j;
|
||||
|
||||
for(i = 0; i < bytes; i++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue