]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
winhttp: Properly destroy linked list if connection can't be opened
authorTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 14:27:53 +0000 (15:27 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 4 Mar 2025 14:27:53 +0000 (15:27 +0100)
src/libstrongswan/plugins/winhttp/winhttp_fetcher.c

index aad6811af42f38a1af17375a22fba0b63748043a..e387bbb937e306e6324bb31f6194ffaae9356e8b 100644 (file)
@@ -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;
        }