1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

lavf/avidec: fix memory leak in error handling path

free the value in error handling path to avoid the memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Jun Zhao 2019-09-10 19:39:27 +08:00 committed by Michael Niedermayer
parent de5543d8d4
commit 3740bdee77

View File

@ -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);