mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +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
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…
Add table
Add a link
Reference in a new issue