aboutsummaryrefslogtreecommitdiff
path: root/stdlib/cxa_finalize.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/cxa_finalize.c')
-rw-r--r--stdlib/cxa_finalize.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/stdlib/cxa_finalize.c b/stdlib/cxa_finalize.c
index e42f6bd71c..16f50286e1 100644
--- a/stdlib/cxa_finalize.c
+++ b/stdlib/cxa_finalize.c
@@ -29,15 +29,12 @@ __cxa_finalize (void *d)
{
struct exit_function_list *funcs;
- if (!d)
- return;
-
for (funcs = __exit_funcs; funcs; funcs = funcs->next)
{
struct exit_function *f;
for (f = &funcs->fns[funcs->idx - 1]; f >= &funcs->fns[0]; --f)
- if (d == f->func.cxa.dso_handle
+ if ((d == NULL || d == f->func.cxa.dso_handle)
/* We don't want to run this cleanup more than once. */
&& compare_and_swap (&f->flavor, ef_cxa, ef_free))
(*f->func.cxa.fn) (f->func.cxa.arg, 0);