Fixed: Memory leak

This commit is contained in:
kervala 2016-02-23 19:41:49 +01:00
parent fbd47b955c
commit 968931dc91

View file

@ -132,19 +132,27 @@ void CCDBSynchronised::read( const string &fileName )
// value // value
token = strtok(buffer," \t"); token = strtok(buffer," \t");
if( token == NULL ) continue;
if (token)
{
sint64 value; sint64 value;
fromString((const char*)token, value); fromString((const char*)token, value);
// property name // property name
token = strtok(NULL," \n"); token = strtok(NULL," \n");
if( token == NULL ) continue;
if (token)
{
string propName(token); string propName(token);
// set the value of the property // set the value of the property
ICDBNode::CTextId txtId(propName); ICDBNode::CTextId txtId(propName);
_Database->setProp(txtId, value); _Database->setProp(txtId, value);
} }
}
delete [] buffer;
}
f.close(); f.close();
@ -177,7 +185,6 @@ void CCDBSynchronised::write( const string &fileName )
{ {
nlwarning("<CCDBSynchronised::write> can't write %s : the database has not been initialized",fileName.c_str()); nlwarning("<CCDBSynchronised::write> can't write %s : the database has not been initialized",fileName.c_str());
} }
} // write // } // write //