summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-03-29 15:36:42 +0300
committerAndreas Kling <kling@serenityos.org>2021-03-29 19:56:54 +0200
commit9eaa6527f73b9e219c93b895a9f32684f7f875f4 (patch)
tree1af680ff263ae1042c066fe66aa1ac5f872fb209 /Userland/Libraries
parentdeda7c899525eeb989ab79d5d9e24d685569c84d (diff)
downloadserenity-9eaa6527f73b9e219c93b895a9f32684f7f875f4.zip
LibC: Mark atexit() entries as 'called' before calling them
This guards as from recursing into an atexit callback if exit() is called from within it.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibC/cxxabi.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/cxxabi.cpp b/Userland/Libraries/LibC/cxxabi.cpp
index 064c39d87d..f6819d40ea 100644
--- a/Userland/Libraries/LibC/cxxabi.cpp
+++ b/Userland/Libraries/LibC/cxxabi.cpp
@@ -101,10 +101,10 @@ void __cxa_finalize(void* dso_handle)
bool needs_calling = !exit_entry.has_been_called && (!dso_handle || dso_handle == exit_entry.dso_handle);
if (needs_calling) {
dbgln_if(GLOBAL_DTORS_DEBUG, "__cxa_finalize: calling entry[{}] {:p}({:p}) dso: {:p}", entry_index, exit_entry.method, exit_entry.parameter, exit_entry.dso_handle);
- exit_entry.method(exit_entry.parameter);
unlock_atexit_handlers();
exit_entry.has_been_called = true;
lock_atexit_handlers();
+ exit_entry.method(exit_entry.parameter);
}
}
}