avcodec/h264: Fix memleak in case of ff_h264_decode_extradata() failure

Fixes Ticket5139

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-01-28 03:18:20 +01:00
parent 02bd02da5f
commit e0b187e7da
1 changed files with 3 additions and 1 deletions

View File

@ -52,6 +52,8 @@
#include "thread.h"
#include "vdpau_compat.h"
static int h264_decode_end(AVCodecContext *avctx);
const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 };
int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx)
@ -679,7 +681,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
if (avctx->extradata_size > 0 && avctx->extradata) {
ret = ff_h264_decode_extradata(h, avctx->extradata, avctx->extradata_size);
if (ret < 0) {
ff_h264_free_context(h);
h264_decode_end(avctx);
return ret;
}
}