diff options
author | Janne Grunau <janne-libav@jannau.net> | 2012-10-09 16:07:12 +0200 |
---|---|---|
committer | Janne Grunau <janne-libav@jannau.net> | 2012-10-09 16:07:12 +0200 |
commit | 714f5ab59780de9da546a24335a6976dac18fbe3 (patch) | |
tree | d7f99a3c1644cf3592180e5d6f8cda1af7360976 /libavcodec/vc1dec.c | |
parent | 1afd7a118fd71536971f991b823c89f1c9e87509 (diff) | |
download | ffmpeg-714f5ab59780de9da546a24335a6976dac18fbe3.tar.gz |
vc1dec: prevent memory leak on av_realloc error
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index df3a55a0ba..13303dc059 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5364,9 +5364,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, break; case VC1_CODE_FIELD: { int buf_size3; - slices = av_realloc(slices, sizeof(*slices) * (n_slices+1)); - if (!slices) + tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); + if (!tmp) goto err; + slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; @@ -5388,9 +5389,10 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, break; case VC1_CODE_SLICE: { int buf_size3; - slices = av_realloc(slices, sizeof(*slices) * (n_slices+1)); - if (!slices) + tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); + if (!tmp) goto err; + slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; |