diff --git a/sandboxed_api/sandbox2/executor.cc b/sandboxed_api/sandbox2/executor.cc index 0474a27..8552f72 100644 --- a/sandboxed_api/sandbox2/executor.cc +++ b/sandboxed_api/sandbox2/executor.cc @@ -60,6 +60,12 @@ Executor::Executor(int exec_fd, const std::string& path, SetDefaultCwd(); } +Executor::~Executor() { + if (client_comms_fd_ != -1) { + close(client_comms_fd_); + } +} + std::vector Executor::CopyEnviron() { std::vector environ_copy; util::CharPtrArrToVecString(environ, &environ_copy); diff --git a/sandboxed_api/sandbox2/executor.h b/sandboxed_api/sandbox2/executor.h index e3515b4..2333dd5 100644 --- a/sandboxed_api/sandbox2/executor.h +++ b/sandboxed_api/sandbox2/executor.h @@ -72,6 +72,8 @@ class Executor final { /*enable_sandboxing_pre_execve=*/false, /*libunwind_sbox_for_pid=*/0, fork_client) {} + ~Executor(); + // Creates a new process which will act as a custom ForkServer. Should be used // with custom fork servers only. // This function returns immediately and returns a nullptr on failure.