Browse Source

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>
tags/n4.3
Jun Zhao Michael Niedermayer 6 years ago
parent
commit
3740bdee77
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavformat/avidec.c

+ 3
- 1
libavformat/avidec.c 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);


Loading…
Cancel
Save