From: Evan Hunt Date: Sat, 3 Apr 2021 05:34:18 +0000 (-0700) Subject: rearrange nm_teardown() to check correctness after shutting down X-Git-Tag: v9.17.12~10^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=426c40c96d81f704c653e3a806278b6a90cd7cf1;p=thirdparty%2Fbind9.git rearrange nm_teardown() to check correctness after shutting down if a test failed at the beginning of nm_teardown(), the function would abort before isc_nm_destroy() or isc_tlsctx_free() were reached; we would then abort when nm_setup() was run for the next test case. rearranging the teardown function prevents this problem. --- diff --git a/lib/isc/tests/netmgr_test.c b/lib/isc/tests/netmgr_test.c index 631001e4089..04362a361a7 100644 --- a/lib/isc/tests/netmgr_test.c +++ b/lib/isc/tests/netmgr_test.c @@ -330,27 +330,27 @@ static int nm_teardown(void **state __attribute__((unused))) { UNUSED(state); - WAIT_FOR_EQ(active_cconnects, 0); - WAIT_FOR_EQ(active_csends, 0); - WAIT_FOR_EQ(active_csends, 0); - WAIT_FOR_EQ(active_ssends, 0); - WAIT_FOR_EQ(active_sreads, 0); - isc_nm_destroy(&connect_nm); assert_null(connect_nm); isc_nm_destroy(&listen_nm); assert_null(listen_nm); + isc_tlsctx_free(&tcp_connect_tlsctx); + isc_tlsctx_free(&tcp_listen_tlsctx); + + WAIT_FOR_EQ(active_cconnects, 0); + WAIT_FOR_EQ(active_csends, 0); + WAIT_FOR_EQ(active_csends, 0); + WAIT_FOR_EQ(active_ssends, 0); + WAIT_FOR_EQ(active_sreads, 0); + isc_refcount_destroy(&active_cconnects); isc_refcount_destroy(&active_csends); isc_refcount_destroy(&active_creads); isc_refcount_destroy(&active_ssends); isc_refcount_destroy(&active_sreads); - isc_tlsctx_free(&tcp_connect_tlsctx); - isc_tlsctx_free(&tcp_listen_tlsctx); - return (0); }