From: Alan T. DeKok Date: Tue, 30 Jan 2024 17:46:13 +0000 (-0500) Subject: call request_global_free() after request_global_init() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44df6a1370e57df5b4b3119700da6861acb4dba9;p=thirdparty%2Ffreeradius-server.git call request_global_free() after request_global_init() --- diff --git a/src/lib/server/pair_server_tests.c b/src/lib/server/pair_server_tests.c index af11ff92049..f1925ac57e8 100644 --- a/src/lib/server/pair_server_tests.c +++ b/src/lib/server/pair_server_tests.c @@ -34,9 +34,11 @@ */ #ifdef USE_CONSTRUCTOR static void test_init(void) __attribute__((constructor)); +static void test_free(void) __attribute__((destructor)); #else static void test_init(void); # define TEST_INIT test_init() +# define TEST_FINI test_free() #endif #include @@ -87,6 +89,11 @@ static void test_init(void) if (request_global_init() < 0) goto error; } +static void test_free(void) +{ + request_global_free(); +} + static request_t *request_fake_alloc(void) { request_t *request; diff --git a/src/lib/server/tmpl_dcursor_tests.c b/src/lib/server/tmpl_dcursor_tests.c index 3720ec18122..ec8191d55dd 100644 --- a/src/lib/server/tmpl_dcursor_tests.c +++ b/src/lib/server/tmpl_dcursor_tests.c @@ -1,10 +1,12 @@ #define USE_CONSTRUCTOR #ifdef USE_CONSTRUCTOR -static void test_init(void) __attribute((constructor)); +static void test_init(void) __attribute__((constructor)); +static void test_free(void) __attribute__((destructor)); #else static void test_init(void); -#define TEST_INIT test_init() +# define TEST_INIT test_init() +# define TEST_FINI test_free() #endif #include @@ -40,6 +42,11 @@ static void test_init(void) if (request_global_init() < 0) goto error; } +static void test_free(void) +{ + request_global_free(); +} + static request_t *request_fake_alloc(void) { request_t *request;