aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2012-04-10 11:31:03 -0700
committerMichael Niedermayer <michaelni@gmx.at>2012-04-11 15:54:53 +0200
commit309a931a38b42c0a635f096cdbea9c21c5e54eab (patch)
tree30e51651f7bd8f9c8a9b16f24702ceddab7b761e
parentca4a3f4a08de04344e5cb16b506564969a43ed7e (diff)
downloadffmpeg-309a931a38b42c0a635f096cdbea9c21c5e54eab.tar.gz
Fix memory leaks on failed ff_h264_decode_init()
During failure conditions ff_h264_decode_init() leaks memory allocated for nal units. Found via valgrind. Valgrind traces: http://pastebin.com/GqTqxs8T Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/h264.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index b909600b3e..2903cf9a6d 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1251,8 +1251,10 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
}
if (avctx->extradata_size > 0 && avctx->extradata &&
- ff_h264_decode_extradata(h, avctx->extradata, avctx->extradata_size) < 0)
+ ff_h264_decode_extradata(h, avctx->extradata, avctx->extradata_size) < 0) {
+ ff_h264_free_context(h);
return -1;
+ }
if (h->sps.bitstream_restriction_flag &&
s->avctx->has_b_frames < h->sps.num_reorder_frames) {