From d1cc847ab072df88e7bfc51e5b955fad00011ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 23 Sep 2022 16:06:42 +0200 Subject: [PATCH] Check the libuv, OpenSSL and libxml2 memory context on exit As we can't check the deallocations done in the library memory contexts by default because it would always fail on non-clean exit (that happens on error or by calling exit() early), we just want to enable the checks to be done on normal exit. --- bin/dig/Makefile.am | 3 ++- bin/dig/dighost.c | 9 +++++++++ bin/named/main.c | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/dig/Makefile.am b/bin/dig/Makefile.am index 32dea5bbfd..b36f0f4525 100644 --- a/bin/dig/Makefile.am +++ b/bin/dig/Makefile.am @@ -6,7 +6,8 @@ AM_CPPFLAGS += \ $(LIBISCCFG_CFLAGS) \ $(LIBIRS_CFLAGS) \ $(LIBBIND9_CFLAGS) \ - $(LIBIDN2_CFLAGS) + $(LIBIDN2_CFLAGS) \ + $(LIBUV_CFLAGS) LDADD += \ libdighost.la \ diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 519c7ef0b1..a8ecf3f55f 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -54,8 +54,11 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -4701,6 +4704,12 @@ destroy_libs(void) { } isc_managers_destroy(&mctx, &loopmgr, &netmgr, &taskmgr); + + isc__tls_setdestroycheck(true); + isc__uv_setdestroycheck(true); + isc__xml_setdestroycheck(true); + + isc_mem_checkdestroyed(stderr); } #ifdef HAVE_LIBIDN2 diff --git a/bin/named/main.c b/bin/named/main.c index 3eba68479d..236c55d942 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -1584,6 +1584,10 @@ main(int argc, char *argv[]) { &named_g_taskmgr); isc_mem_checkdestroyed(stderr); + isc__tls_setdestroycheck(true); + isc__uv_setdestroycheck(true); + isc__xml_setdestroycheck(true); + named_main_setmemstats(NULL); named_os_closedevnull();