Commit 3740bdee authored by Jun Zhao's avatar Jun Zhao Committed by Michael Niedermayer

lavf/avidec: fix memory leak in error handling path

free the value in error handling path to avoid the memory leak.
Signed-off-by: 's avatarJun Zhao <barryjzhao@tencent.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent de5543d8
......@@ -306,8 +306,10 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag,
value = av_malloc(size + 1);
if (!value)
return AVERROR(ENOMEM);
if (avio_read(pb, value, size) != size)
if (avio_read(pb, value, size) != size) {
av_freep(&value);
return AVERROR_INVALIDDATA;
}
value[size] = 0;
AV_WL32(key, tag);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment