Commit aebc956a22 for ffmpeg

commit aebc956a224e1b5a921b38ead49725494d56f795
Author: Martin Mirchev <mmirchev@comp.nus.edu.sg>
Date:   Tue Nov 10 12:01:40 2026 +0800

    avformat/http: free the zlib state when the open fails

    parse_content_encoding() initialises the inflate stream as soon as a
    Content-Encoding: gzip or deflate header is read. If the open fails
    after that, e.g. because the connection ends before the end of the
    headers, http_close() is not called and the stream is never freed:
    LeakSanitizer reports 7160 bytes per failed open.

    Call inflateEnd() in the error path of http_open(). inflateEnd() is a
    no-op on a stream that was never initialised.

    Reported in the review of #25635.

    Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>

diff --git a/libavformat/http.c b/libavformat/http.c
index 2f4f522363..a7854122f1 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -864,6 +864,9 @@ static int http_open(URLContext *h, const char *uri, int flags,
     ret = http_open_cnx(h, options, 0);
 bail_out:
     if (ret < 0) {
+#if CONFIG_ZLIB
+        inflateEnd(&s->inflate_stream);
+#endif
         av_dict_free(&s->chained_options);
         av_dict_free(&s->cookie_dict);
         av_dict_free(&s->redirect_cache);