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{

View File

@ -128,6 +128,8 @@ RsRegularExpression::Expression * AdvancedSearchDialog::getRsExpr()
// iterate through the items in elements and
#warning Phenom (2017-07-21): I don't know if it is a real memLeak for wholeExpression. If not remove this warning and add a comment how it is deleted.
// cppcheck-suppress memleak
for (int i = 1; i < expressions->size(); ++i) {
// extract the expression information and compound it with the
// first expression

View File

@ -395,7 +395,7 @@ ChatPage::load()
// load personal invites
//
#ifdef TO_BE_DONE
for()
for(;;)
{
QListWidgetItem *item = new QListWidgetItem;
item->setData(Qt::DisplayRole,tr("Private chat invite from")+" "+QString::fromUtf8(detail.name.c_str())) ;

View File

@ -25,6 +25,8 @@ element * cons(element *new, element *list) {
element *reverse(element *list) {
element *new = NULL;
element *next = NULL;
#warning Phenom (2017-07-21): I don't know if it is a real memLeak for new. If not remove this warning and add a comment how it is deleted.
// cppcheck-suppress memleak
while (list != NULL) {
next = list->next;
new = cons(list, new);