Merge pull request #957 from PhenomRetroShare/Fix_CppCheckerError

Fix cpp checker error
This commit is contained in:
csoler 2017-07-26 13:54:44 +02:00 committed by GitHub
commit 34ddf71703
5 changed files with 19 additions and 6 deletions

View file

@ -425,7 +425,7 @@ public:
bool no_ts = (it == mLastUsageTS.end()) ;
time_t last_usage_ts = no_ts?0:(it->second.TS);
time_t max_keep_time ;
time_t max_keep_time = 0;
bool should_check = true ;
if(no_ts)
@ -1207,13 +1207,17 @@ bool p3IdService::encryptData( const uint8_t* decrypted_data,
for( int i=0; i < maxRounds; ++i )
{
for( std::set<const RsGxsId*>::iterator it = keyNotYetFoundIds.begin();
it !=keyNotYetFoundIds.end(); ++it )
it !=keyNotYetFoundIds.end(); )
{
RsTlvPublicRSAKey encryption_key;
if(getKey(**it, encryption_key) && !encryption_key.keyId.isNull())
{
encryption_keys.push_back(encryption_key);
keyNotYetFoundIds.erase(it);
it = keyNotYetFoundIds.erase(it);
}
else
{
++it;
}
}
@ -1336,14 +1340,18 @@ bool p3IdService::decryptData( const uint8_t* encrypted_data,
for( int i=0; i < maxRounds; ++i )
{
for( std::set<const RsGxsId*>::iterator it = keyNotYetFoundIds.begin();
it !=keyNotYetFoundIds.end(); ++it )
it !=keyNotYetFoundIds.end(); )
{
RsTlvPrivateRSAKey decryption_key;
if( getPrivateKey(**it, decryption_key)
&& !decryption_key.keyId.isNull() )
{
decryption_keys.push_back(decryption_key);
keyNotYetFoundIds.erase(it);
it = keyNotYetFoundIds.erase(it);
}
else
{
++it;
}
}

View file

@ -185,6 +185,7 @@ void ContentValue::put(const std::string &key, uint32_t len, const char* value){
mKvData.insert(std::pair<std::string, std::pair<uint32_t, char*> >
(key, std::pair<uint32_t, char*>(len, dest)));
//delete[] dest; //Deleted by clearData()
// cppcheck-suppress memleak
}
bool ContentValue::getAsBool(const std::string &key, bool& value) const{