diff mbox series

[FFmpeg-devel,2/6] avformat/rtsp: free the alloc memory if failed

Message ID 1638714396-23062-2-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/6] avformat/rtsp: remove redundant assignment | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Dec. 5, 2021, 2:26 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/rtsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 47120fd..5cffe0b 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1245,8 +1245,10 @@  start:
         content = av_malloc(content_length + 1);
         if (!content)
             return AVERROR(ENOMEM);
-        if (ffurl_read_complete(rt->rtsp_hd, content, content_length) != content_length)
+        if (ffurl_read_complete(rt->rtsp_hd, content, content_length) != content_length) {
+            av_freep(&content);
             return AVERROR(EIO);
+        }
         content[content_length] = '\0';
     }
     if (content_ptr)