From ac13579b9963a312b909e712c372cb115f21f0db Mon Sep 17 00:00:00 2001 From: Trial97 Date: Mon, 14 Oct 2024 11:10:54 +0300 Subject: [PATCH] fix heap-use-after-free in modrinth creation task Signed-off-by: Trial97 --- .../modplatform/modrinth/ModrinthInstanceCreationTask.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp index 3442fd19c..994dd774f 100644 --- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp +++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp @@ -301,6 +301,13 @@ bool ModrinthCreationTask::createInstance() loop.exec(); + if (!ended_well) { + for (auto m : mods) { + delete m; + } + return ended_well; + } + QEventLoop ensureMetaLoop; QDir folder = FS::PathCombine(instance.modsRoot(), ".index"); auto ensureMetadataTask = makeShared(mods, folder, ModPlatform::ResourceProvider::MODRINTH);