winhttp: Properly destroy linked list if connection can't be opened

This commit is contained in:
Tobias Brunner 2025-03-04 15:27:53 +01:00
parent a70ba4d600
commit 380ec66c92

View 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;
}