From e1c2dacc474f2e4d4f115715697483b8fde27972 Mon Sep 17 00:00:00 2001 From: flb Date: Mon, 23 Aug 2021 15:07:09 +0200 Subject: [PATCH] attempt to fix 2345-0008 crashes --- lib/borealis | 2 +- lib/zipper | 2 +- source/app_page.cpp | 5 ++--- source/extract.cpp | 8 +++++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/borealis b/lib/borealis index 5bbadc9..b81a39f 160000 --- a/lib/borealis +++ b/lib/borealis @@ -1 +1 @@ -Subproject commit 5bbadc951734876bc74490302de561c1bb0231ad +Subproject commit b81a39f73b98aa61919b251521ba1297157a3cf7 diff --git a/lib/zipper b/lib/zipper index f806815..29f0275 160000 --- a/lib/zipper +++ b/lib/zipper @@ -1 +1 @@ -Subproject commit f80681569d73ffb27e85473e3bccb95b9856f1c1 +Subproject commit 29f02751f063c2440d363f2049b0b59f5b330b20 diff --git a/source/app_page.cpp b/source/app_page.cpp index 1622bc3..5caea79 100644 --- a/source/app_page.cpp +++ b/source/app_page.cpp @@ -46,9 +46,8 @@ void AppPage::PopulatePage() listItem = new brls::ListItem(name, "", util::formatApplicationId(tid)); this->DeclareGameListItem(name, tid, &controlData); - - free(controlData); } + free(controlData); delete[] records; } } @@ -105,9 +104,9 @@ void AppPage::CreateDownloadAllButton() } u32 AppPage::InitControlData(NsApplicationControlData** controlData) { + free(controlData); *controlData = (NsApplicationControlData*)malloc(sizeof(NsApplicationControlData)); if(*controlData == NULL) { - free(*controlData); return 300; } else { diff --git a/source/extract.cpp b/source/extract.cpp index cc3193e..e394394 100644 --- a/source/extract.cpp +++ b/source/extract.cpp @@ -114,9 +114,9 @@ std::vector getInstalledTitlesNs(){ if (R_SUCCEEDED(nsListApplicationRecord(records, MaxTitleCount, 0, &recordCount))){ for (s32 i = 0; i < recordCount; i++){ controlSize = 0; + free(controlData); controlData = (NsApplicationControlData*)malloc(sizeof(NsApplicationControlData)); if(controlData == NULL) { - free(controlData); break; } else { @@ -125,11 +125,13 @@ std::vector getInstalledTitlesNs(){ if(R_FAILED(nsGetApplicationControlData(NsApplicationControlSource_Storage, records[i].application_id, controlData, sizeof(NsApplicationControlData), &controlSize))) continue; - if(controlSize < sizeof(controlData->nacp)) continue; + if(controlSize < sizeof(controlData->nacp)) { + continue; + } titles.push_back(util::formatApplicationId(records[i].application_id)); - free(controlData); } + free(controlData); } delete[] records; std::sort(titles.begin(), titles.end());