mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibCore: Fix memory leak in Core::Process::spawn()
Previously the spawn_actions were not destroyed, which leaked a little memory.
This commit is contained in:
parent
d0ac24ddbf
commit
62e8360dcf
Notes:
sideshowbarker
2024-07-17 11:06:06 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/62e8360dcf Pull-request: https://github.com/SerenityOS/serenity/pull/17840 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/kleinesfilmroellchen ✅
1 changed files with 5 additions and 1 deletions
|
@ -1,12 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibCore/Process.h>
|
||||
|
@ -58,6 +59,9 @@ struct ArgvList {
|
|||
#ifdef AK_OS_SERENITY
|
||||
posix_spawn_file_actions_t spawn_actions;
|
||||
posix_spawn_file_actions_init(&spawn_actions);
|
||||
ScopeGuard cleanup_spawn_actions = [&] {
|
||||
posix_spawn_file_actions_destroy(&spawn_actions);
|
||||
};
|
||||
if (!m_working_directory.is_empty())
|
||||
posix_spawn_file_actions_addchdir(&spawn_actions, m_working_directory.characters());
|
||||
|
||||
|
|
Loading…
Reference in a new issue