From 76ea8f7de4fbf3501b15285cd00e60cd52da4e82 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Thu, 26 Jan 2023 02:34:39 +0100 Subject: [PATCH] lib-http: http-client - Make http_client_global_context_free() public for testing. --- src/lib-http/http-client.c | 5 ++++- src/lib-http/http-client.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib-http/http-client.c b/src/lib-http/http-client.c index 0058d1a030..22c2e1d6d6 100644 --- a/src/lib-http/http-client.c +++ b/src/lib-http/http-client.c @@ -726,8 +726,11 @@ http_client_global_context_ioloop_switched( } } -static void http_client_global_context_free(void) +void http_client_global_context_free(void) { + if (http_client_global_context == NULL) + return; + /* Drop ioloop switch callback to make absolutely sure there is no recursion. */ io_loop_remove_switch_callback( diff --git a/src/lib-http/http-client.h b/src/lib-http/http-client.h index 227376a0fa..7439fe0d16 100644 --- a/src/lib-http/http-client.h +++ b/src/lib-http/http-client.h @@ -497,4 +497,8 @@ void http_client_context_unref(struct http_client_context **_cctx); returned context. */ struct http_client_context *http_client_get_global_context(void); +/* Explicitly free the global context. This function is only useful for testing: + the global context is cleaned up implicitly. */ +void http_client_global_context_free(void); + #endif -- 2.47.3