diff options
author | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-11-24 04:51:05 +0100 |
---|---|---|
committer | Lukasz Marek <lukasz.m.luki2@gmail.com> | 2014-11-25 22:18:08 +0100 |
commit | e29153f414f5b2d10e0386abf7921aed4a4fa454 (patch) | |
tree | d5b9e2e301340284deee57673bdf686bcc57878d /libavcodec/avuienc.c | |
parent | 23e91a1bfd7f47b343f41915a2c8b33d5c532562 (diff) | |
download | ffmpeg-e29153f414f5b2d10e0386abf7921aed4a4fa454.tar.gz |
lavc/avuienc: fix mem leak in case of init failure
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
Diffstat (limited to 'libavcodec/avuienc.c')
-rw-r--r-- | libavcodec/avuienc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c index 700b8cbd4b..db640bb5a9 100644 --- a/libavcodec/avuienc.c +++ b/libavcodec/avuienc.c @@ -25,16 +25,10 @@ static av_cold int avui_encode_init(AVCodecContext *avctx) { - avctx->coded_frame = av_frame_alloc(); - if (avctx->width != 720 || avctx->height != 486 && avctx->height != 576) { av_log(avctx, AV_LOG_ERROR, "Only 720x486 and 720x576 are supported.\n"); return AVERROR(EINVAL); } - if (!avctx->coded_frame) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); - return AVERROR(ENOMEM); - } if (!(avctx->extradata = av_mallocz(24 + FF_INPUT_BUFFER_PADDING_SIZE))) return AVERROR(ENOMEM); avctx->extradata_size = 24; @@ -45,6 +39,11 @@ static av_cold int avui_encode_init(AVCodecContext *avctx) avctx->extradata[19] = 1; } + avctx->coded_frame = av_frame_alloc(); + if (!avctx->coded_frame) { + av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); + return AVERROR(ENOMEM); + } return 0; } |