Commit 05c674c913 for ffmpeg
commit 05c674c9132eb13e65e3fb6e9b4cf1cad1219fd5
Author: Zhao Zhili <quinkblack@foxmail.com>
Date: Thu Nov 19 11:05:14 2026 +0800
avformat/http: fix leak on failed proxy reconnect
After a 407 reply that asks for authentication, http_proxy_open()
closes the connection and reconnects. The reply headers parsed so far
may already have allocated state, for example the zlib stream set up
by Content-Encoding and new_location set by Location.
If the reconnect fails, returning directly skips http_proxy_close(),
and ffurl_closep() does not call url_close for a context that never
finished opening. Go through the fail label so that state is freed.
diff --git a/libavformat/http.c b/libavformat/http.c
index d4dde2b017..9325130aeb 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -2490,7 +2490,7 @@ redo:
&h->interrupt_callback, NULL,
h->protocol_whitelist, h->protocol_blacklist, h);
if (ret < 0)
- return ret;
+ goto fail;
authstr = ff_http_auth_create_response(&s->proxy_auth_state, auth,
path, "CONNECT");