You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +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:
committed by
Michael Niedermayer
parent
de5543d8d4
commit
3740bdee77
@@ -306,8 +306,10 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag,
|
|||||||
value = av_malloc(size + 1);
|
value = av_malloc(size + 1);
|
||||||
if (!value)
|
if (!value)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
if (avio_read(pb, value, size) != size)
|
if (avio_read(pb, value, size) != size) {
|
||||||
|
av_freep(&value);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
value[size] = 0;
|
value[size] = 0;
|
||||||
|
|
||||||
AV_WL32(key, tag);
|
AV_WL32(key, tag);
|
||||||
|
Reference in New Issue
Block a user