aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2021-12-05 21:13:51 +0800
committerLimin Wang <lance.lmwang@gmail.com>2021-12-07 20:33:17 +0800
commitf210766a55ea2db85b01038e0f4a4b8891d1903b (patch)
treea1f26ade99d88a90adbe21347b86c38d1f521f68 /libavformat
parent130e4c6f4c3a7daeaeee4d195c1122f21fbc95c7 (diff)
downloadffmpeg-f210766a55ea2db85b01038e0f4a4b8891d1903b.tar.gz
avformat/rtsp: free the alloc memory if failed
Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtsp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 47120fdf61..5cffe0b6b5 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)