From 19494b436b1c1bc3e11de6af549471b14205a2cb Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 6 Oct 2022 18:27:24 +0200 Subject: [PATCH] LibWeb: Fix unsafe capture in fetch_external_module_script_graph() We can't be capturing the AK::URL by reference here, since on_complete may be called later, after the value is no longer alive. --- Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp index 2e7492729c..6e18fc7dfe 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Fetching.cpp @@ -268,7 +268,7 @@ void fetch_external_module_script_graph(AK::URL const& url, EnvironmentSettingsO { // 1. Fetch a single module script given url, settings object, "script", options, settings object, "client", true, and with the following steps given result: // FIXME: Pass options. - fetch_single_module_script(url, settings_object, "script"sv, settings_object, "client"sv, {}, TopLevelModule::Yes, [&settings_object, on_complete = move(on_complete), &url](auto* result) mutable { + fetch_single_module_script(url, settings_object, "script"sv, settings_object, "client"sv, {}, TopLevelModule::Yes, [&settings_object, on_complete = move(on_complete), url](auto* result) mutable { // 1. If result is null, run onComplete given null, and abort these steps. if (!result) { on_complete(nullptr);