From 380ec66c92d48f6144cc21a0117523e6401c64c3 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 4 Mar 2025 15:27:53 +0100 Subject: [PATCH] winhttp: Properly destroy linked list if connection can't be opened --- src/libstrongswan/plugins/winhttp/winhttp_fetcher.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c b/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c index aad6811af4..e387bbb937 100644 --- a/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c +++ b/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c @@ -359,7 +359,10 @@ METHOD(fetcher_t, set_option, bool, METHOD(fetcher_t, destroy, void, private_winhttp_fetcher_t *this) { - WinHttpCloseHandle(this->session); + if (this->session) + { + WinHttpCloseHandle(this->session); + } this->headers->destroy_function(this->headers, free); free(this); } @@ -389,7 +392,7 @@ winhttp_fetcher_t *winhttp_fetcher_create() if (!this->session) { - free(this); + destroy(this); return NULL; } -- 2.47.2