[FFmpeg-devel] [PATCH 1/3] avformat/rtspdec: set dangling pointers to NULL

Andriy Gelman andriy.gelman at gmail.com
Sun Oct 11 22:03:28 EEST 2020


From: Andriy Gelman <andriy.gelman at gmail.com>

Otherwise a double free will occur in case rtsp_read_close() is called
on error.

Signed-off-by: Andriy Gelman <andriy.gelman at gmail.com>
---
 libavformat/rtspdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index ef084a8b2b..b519b6f1a2 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -691,7 +691,8 @@ static int rtsp_listen(AVFormatContext *s)
         } else if (methodcode == SETUP)
             ret = rtsp_read_setup(s, host, uri);
         if (ret) {
-            ffurl_close(rt->rtsp_hd);
+            ffurl_closep(&rt->rtsp_hd);
+            rt->rtsp_hd_out = NULL;
             return AVERROR_INVALIDDATA;
         }
     }
-- 
2.28.0



More information about the ffmpeg-devel mailing list