[FFmpeg-cvslog] avformat/rtsp: fix leak of options dict on error

Marvin Scholz git at videolan.org
Thu Jul 10 14:22:51 EEST 2025


ffmpeg | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Jul  8 20:15:13 2025 +0200| [82aeee3c19f42d4a03b221fdd0ef9dfeb060a37e] | committer: Marvin Scholz

avformat/rtsp: fix leak of options dict on error

Fix CID 1655306

Reviewed-by: Kieran Kunhya <kierank at obe.tv>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=82aeee3c19f42d4a03b221fdd0ef9dfeb060a37e
---

 libavformat/rtsp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 8d360b375f..0810c56a8b 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1847,6 +1847,7 @@ redirect:
         /* GET requests */
         if (ffurl_alloc(&rt->rtsp_hd, httpname, AVIO_FLAG_READ,
                         &s->interrupt_callback) < 0) {
+            av_dict_free(&options);
             err = AVERROR(EIO);
             goto fail;
         }
@@ -1863,6 +1864,7 @@ redirect:
         if (!rt->rtsp_hd->protocol_whitelist && s->protocol_whitelist) {
             rt->rtsp_hd->protocol_whitelist = av_strdup(s->protocol_whitelist);
             if (!rt->rtsp_hd->protocol_whitelist) {
+                av_dict_free(&options);
                 err = AVERROR(ENOMEM);
                 goto fail;
             }
@@ -1878,6 +1880,7 @@ redirect:
         /* POST requests */
         if (ffurl_alloc(&rt->rtsp_hd_out, httpname, AVIO_FLAG_WRITE,
                         &s->interrupt_callback) < 0 ) {
+            av_dict_free(&options);
             err = AVERROR(EIO);
             goto fail;
         }



More information about the ffmpeg-cvslog mailing list