Skip to content

Commit

Permalink
Fix a couple of memory leaks in mythgame. Coverity defects 703765 & 7…
Browse files Browse the repository at this point in the history
…03766
  • Loading branch information
stuartm committed Jun 4, 2012
1 parent faf6dbc commit 7809398
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions mythplugins/mythgame/mythgame/gamescan.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ void GameScannerThread::updateDB()
{ {
if (!(*p).indb) if (!(*p).indb)
{ {
RomInfo *add = new RomInfo(0, (*p).romfile, (*p).system, RomInfo add(0, (*p).romfile, (*p).system,
(*p).romname, "", "", "", (*p).rompath, (*p).romname, "", "", "", (*p).rompath,
"", "", 0, (*p).gametype, 0, "", "", "", "", "", 0, (*p).gametype, 0, "", "", "",
"", "", "", "", ""); "", "", "", "", "");
add->SaveToDatabase(); add.SaveToDatabase();
m_DBDataChanged = true; m_DBDataChanged = true;
} }
if (m_HasGUI) if (m_HasGUI)
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythgame/mythgame/rominfo.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ QList<RomInfo*> RomInfo::GetAllRomInfo()


RomInfo *RomInfo::GetRomInfoById(int id) RomInfo *RomInfo::GetRomInfoById(int id)
{ {
RomInfo *ret = new RomInfo(); RomInfo *ret = NULL;


MSqlQuery query(MSqlQuery::InitCon()); MSqlQuery query(MSqlQuery::InitCon());


Expand All @@ -382,10 +382,7 @@ RomInfo *RomInfo::GetRomInfoById(int id)
query.bindValue(":INTID", id); query.bindValue(":INTID", id);


if (!query.exec()) if (!query.exec())
{
MythDB::DBError("GetRomInfoById", query); MythDB::DBError("GetRomInfoById", query);
return ret;
}


if (query.next()) if (query.next())
{ {
Expand All @@ -412,6 +409,9 @@ RomInfo *RomInfo::GetRomInfoById(int id)
query.value(17).toString()); query.value(17).toString());
} }


if (!ret)
ret = new RomInfo();

return ret; return ret;
} }


Expand Down

0 comments on commit 7809398

Please sign in to comment.