mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 02:08:52 +01:00
Misc cleanups; memory leaks, use-after-free, use of uninitialized data
There are still a bunch of tiny leaks related to the animation Tween data that I haven't figured out how to resolve, but it runs more cleanly now.
This commit is contained in:
parent
aacb41102f
commit
0ce28a46a2
@ -85,7 +85,7 @@ void Configuration::initialize()
|
|||||||
if(rootPos!=std::string::npos)
|
if(rootPos!=std::string::npos)
|
||||||
sPath = sPath.erase(rootPos);
|
sPath = sPath.erase(rootPos);
|
||||||
#else
|
#else
|
||||||
char exepath[1024];
|
char exepath[1024] = {};
|
||||||
sprintf(exepath, "/proc/%d/exe", getpid());
|
sprintf(exepath, "/proc/%d/exe", getpid());
|
||||||
readlink(exepath, exepath, sizeof(exepath));
|
readlink(exepath, exepath, sizeof(exepath));
|
||||||
std::string sPath(exepath);
|
std::string sPath(exepath);
|
||||||
|
|||||||
@ -327,12 +327,14 @@ void MetadataDatabase::injectMetadata(CollectionInfo *collection)
|
|||||||
}
|
}
|
||||||
rc = sqlite3_step(stmt);
|
rc = sqlite3_step(stmt);
|
||||||
}
|
}
|
||||||
|
sqlite3_finalize(stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MetadataDatabase::needsRefresh()
|
bool MetadataDatabase::needsRefresh()
|
||||||
{
|
{
|
||||||
sqlite3 *handle = db_.handle;
|
sqlite3 *handle = db_.handle;
|
||||||
sqlite3_stmt *stmt;
|
sqlite3_stmt *stmt;
|
||||||
|
bool result;
|
||||||
|
|
||||||
sqlite3_prepare_v2(handle,
|
sqlite3_prepare_v2(handle,
|
||||||
"SELECT COUNT(*) FROM Meta;",
|
"SELECT COUNT(*) FROM Meta;",
|
||||||
@ -357,12 +359,16 @@ bool MetadataDatabase::needsRefresh()
|
|||||||
#endif
|
#endif
|
||||||
time_t metadirTime = timeDir(Utils::combinePath(Configuration::absolutePath, "meta"));
|
time_t metadirTime = timeDir(Utils::combinePath(Configuration::absolutePath, "meta"));
|
||||||
|
|
||||||
return (count == 0 || metadbErr || metadb.st_mtime < metadirTime || exeErr || metadb.st_mtime < exe.st_mtime) ? true : false;
|
result = (count == 0 || metadbErr || metadb.st_mtime < metadirTime || exeErr || metadb.st_mtime < exe.st_mtime) ? true : false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sqlite3_finalize(stmt);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string collectionName)
|
bool MetadataDatabase::importHyperlist(std::string hyperlistFile, std::string collectionName)
|
||||||
|
|||||||
@ -523,7 +523,10 @@ bool Page::popCollection()
|
|||||||
playlist_ = info->playlist;
|
playlist_ = info->playlist;
|
||||||
playlistChange();
|
playlistChange();
|
||||||
|
|
||||||
|
// Remove references to the collection we're about to delete and pop the menu
|
||||||
menuDepth_--;
|
menuDepth_--;
|
||||||
|
activeMenu_->collectionName = "";
|
||||||
|
activeMenu_->setItems(NULL);
|
||||||
activeMenu_ = menus_[menuDepth_ - 1];
|
activeMenu_ = menus_[menuDepth_ - 1];
|
||||||
|
|
||||||
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
for(std::vector<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
|||||||
@ -914,6 +914,7 @@ CollectionInfo *RetroFE::getCollection(std::string collectionName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
closedir(dp);
|
||||||
|
|
||||||
bool menuSort = true;
|
bool menuSort = true;
|
||||||
config_.getProperty("collections." + collectionName + ".list.menuSort", menuSort);
|
config_.getProperty("collections." + collectionName + ".list.menuSort", menuSort);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user