]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check the libuv, OpenSSL and libxml2 memory context on exit
authorOndřej Surý <ondrej@isc.org>
Fri, 23 Sep 2022 14:06:42 +0000 (16:06 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 27 Sep 2022 15:10:42 +0000 (17:10 +0200)
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
bin/dig/dighost.c
bin/named/main.c

index 32dea5bbfdf7ecc6036b068927a52bf32d767876..b36f0f45251aa5d4c1ba727bd2bf740c5fb31160 100644 (file)
@@ -6,7 +6,8 @@ AM_CPPFLAGS +=                  \
        $(LIBISCCFG_CFLAGS)     \
        $(LIBIRS_CFLAGS)        \
        $(LIBBIND9_CFLAGS)      \
-       $(LIBIDN2_CFLAGS)
+       $(LIBIDN2_CFLAGS)       \
+       $(LIBUV_CFLAGS)
 
 LDADD +=                       \
        libdighost.la           \
index 519c7ef0b13153773bb9b9fc5a255210732274c0..a8ecf3f55fe2f25cddc22eb9381821c9836626f3 100644 (file)
 #include <isc/string.h>
 #include <isc/task.h>
 #include <isc/timer.h>
+#include <isc/tls.h>
 #include <isc/types.h>
 #include <isc/util.h>
+#include <isc/uv.h>
+#include <isc/xml.h>
 
 #include <dns/byaddr.h>
 #include <dns/fixedname.h>
@@ -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
index 3eba68479d351802146e86dc0f4d7850510ddff4..236c55d942fe7fa9d84435a62e752c894a8e69b4 100644 (file)
@@ -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();