summaryrefslogtreecommitdiffstats
path: root/libavformat/avidec.c
diff options
context:
space:
mode:
authorJun Zhao <barryjzhao@tencent.com>2019-09-10 19:39:27 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-10 17:21:54 +0200
commit3740bdee77ae1810162fc215172f432fcee2d0f0 (patch)
treea1ac3c1de0ce90f3731f932c6881406f74b0a985 /libavformat/avidec.c
parentde5543d8d442759093c0e0e8beeea1e7a3ff0333 (diff)
downloadffmpeg-streaming-3740bdee77ae1810162fc215172f432fcee2d0f0.zip
ffmpeg-streaming-3740bdee77ae1810162fc215172f432fcee2d0f0.tar.gz
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>
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r--libavformat/avidec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index df78925..e3cd844 100644
--- a/libavformat/avidec.c
+++ b/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);
OpenPOWER on IntegriCloud