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
Expand Up @@ -114,11 +114,11 @@ void GameScannerThread::updateDB()
{
if (!(*p).indb)
{
RomInfo *add = new RomInfo(0, (*p).romfile, (*p).system,
(*p).romname, "", "", "", (*p).rompath,
"", "", 0, (*p).gametype, 0, "", "", "",
"", "", "", "", "");
add->SaveToDatabase();
RomInfo add(0, (*p).romfile, (*p).system,
(*p).romname, "", "", "", (*p).rompath,
"", "", 0, (*p).gametype, 0, "", "", "",
"", "", "", "", "");
add.SaveToDatabase();
m_DBDataChanged = true;
}
if (m_HasGUI)
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythgame/mythgame/rominfo.cpp
Expand Up @@ -369,7 +369,7 @@ QList<RomInfo*> RomInfo::GetAllRomInfo()

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

MSqlQuery query(MSqlQuery::InitCon());

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

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

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

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

return ret;
}

Expand Down

0 comments on commit 7809398

Please sign in to comment.