ffmpeg | branch: master | Steven Liu <[email protected]> | Wed Oct  9 
11:50:49 2019 +0800| [9f0b9ae8bd84b45dc8bc7bcb96607c2948d546d7] | committer: 
Steven Liu

avformat/iff: fix memleak when get st->codecpar->extradata failed in 
iff_read_header

Reviewed-by: Paul B Mahol <[email protected]>
Signed-off-by: Steven Liu <[email protected]>

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

 libavformat/iff.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/iff.c b/libavformat/iff.c
index f4d806b7b8..2a3729f97e 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -529,8 +529,11 @@ static int iff_read_header(AVFormatContext *s)
             st->codecpar->extradata      = av_malloc(data_size + 
IFF_EXTRA_VIDEO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
             if (!st->codecpar->extradata)
                 return AVERROR(ENOMEM);
-            if (avio_read(pb, st->codecpar->extradata + IFF_EXTRA_VIDEO_SIZE, 
data_size) < 0)
+            if (avio_read(pb, st->codecpar->extradata + IFF_EXTRA_VIDEO_SIZE, 
data_size) < 0) {
+                av_freep(&st->codecpar->extradata);
+                st->codecpar->extradata_size = 0;
                 return AVERROR(EIO);
+            }
             break;
 
         case ID_BMHD:

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to