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>
pull/322/head
Jun Zhao 5 years ago committed by Michael Niedermayer
parent de5543d8d4
commit 3740bdee77
  1. 4
      libavformat/avidec.c

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

Loading…
Cancel
Save