From ad9464165cc6189aedbcb6c639a3d6e47579c704 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 21 Feb 2023 18:21:57 +0100 Subject: [PATCH 1/1] logs: protect finalization against multiple calls --- src/xbt/log.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xbt/log.cpp b/src/xbt/log.cpp index 78fd4d5fa4..d546f82e8d 100644 --- a/src/xbt/log.cpp +++ b/src/xbt/log.cpp @@ -98,21 +98,24 @@ void xbt_log_init(int *argc, char **argv) } } -static void log_cat_exit(const s_xbt_log_category_t* cat) +static void log_cat_exit(xbt_log_category_t cat) { if (cat->appender) { if (cat->appender->free_) cat->appender->free_(cat->appender); xbt_free(cat->appender); + cat->appender = nullptr; } if (cat->layout) { if (cat->layout->free_) cat->layout->free_(cat->layout); xbt_free(cat->layout); + cat->layout = nullptr; } for (auto const* child = cat->firstChild; child != nullptr; child = child->nextSibling) - log_cat_exit(child); + log_cat_exit(const_cast(child)); + cat->firstChild = nullptr; } static void xbt_log_postexit(void) -- 2.20.1