PR #26197 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26197
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26197.patch

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.

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From c6e10dbdd5798747f158d1a4ac4ea79c33ec752d Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Thu, 19 Nov 2026 11:05:14 +0800
Subject: [PATCH] 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.
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index d549bb298b4..be78fff3f72 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -2457,7 +2457,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");
-- 
2.54.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to