From: Martin Quinson Date: Tue, 21 Feb 2023 17:21:57 +0000 (+0100) Subject: logs: protect finalization against multiple calls X-Git-Tag: v3.34~475 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ad9464165cc6189aedbcb6c639a3d6e47579c704?hp=b6d29644d566a866a7cec0ab4c601700fdb47020 logs: protect finalization against multiple calls --- 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)