Skip to content

Commit 81499ed

Browse files
authored
[NFC][lldb]Fix stack-use-after-free bugs in exit-callbacks. (#135763)
1 parent 00eaff3 commit 81499ed

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lldb/source/Target/Process.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,10 +1047,11 @@ bool Process::SetExitStatus(int status, llvm::StringRef exit_string) {
10471047
info->exit_desc = {status, exit_string.str()};
10481048
});
10491049

1050-
helper.DispatchOnExit([&](telemetry::ProcessExitInfo *info) {
1051-
info->module_uuid = module_uuid;
1052-
info->pid = m_pid;
1053-
});
1050+
helper.DispatchOnExit(
1051+
[module_uuid, pid = m_pid](telemetry::ProcessExitInfo *info) {
1052+
info->module_uuid = module_uuid;
1053+
info->pid = pid;
1054+
});
10541055

10551056
m_exit_status = status;
10561057
if (!exit_string.empty())

lldb/source/Target/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
15781578
info->is_start_entry = true;
15791579
});
15801580

1581-
helper.DispatchOnExit([&](telemetry::ExecutableModuleInfo *info) {
1581+
helper.DispatchOnExit([&, pid](telemetry::ExecutableModuleInfo *info) {
15821582
info->exec_mod = executable_sp;
15831583
info->uuid = executable_sp->GetUUID();
15841584
info->pid = pid;

0 commit comments

Comments
 (0)