diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-10-29 13:40:34 +0200 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2011-10-29 15:48:43 +0200 |
commit | d9f4dc52a0fe3edb93f153cf13e750f7c46243d1 (patch) | |
tree | 536f829b2c0305c6058b7d62416d29c940207c8e /libavcodec/proresenc.c | |
parent | 5c9b9165cd82478a6d26294561767d60439040d3 (diff) | |
download | ffmpeg-d9f4dc52a0fe3edb93f153cf13e750f7c46243d1.tar.gz |
Only do 1 malloc instead of 3 and check for failure.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/proresenc.c')
-rw-r--r-- | libavcodec/proresenc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/proresenc.c b/libavcodec/proresenc.c index 20ab4512ad..5c3a7c817b 100644 --- a/libavcodec/proresenc.c +++ b/libavcodec/proresenc.c @@ -549,9 +549,11 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) } if ((avctx->height & 0xf) || (avctx->width & 0xf)) { - ctx->fill_y = av_malloc(DEFAULT_SLICE_MB_WIDTH << 9); - ctx->fill_u = av_malloc(DEFAULT_SLICE_MB_WIDTH << 8); - ctx->fill_v = av_malloc(DEFAULT_SLICE_MB_WIDTH << 8); + ctx->fill_y = av_malloc(4 * (DEFAULT_SLICE_MB_WIDTH << 8)); + if (!ctx->fill_y) + return AVERROR(ENOMEM); + ctx->fill_u = ctx->fill_y + (DEFAULT_SLICE_MB_WIDTH << 9); + ctx->fill_v = ctx->fill_u + (DEFAULT_SLICE_MB_WIDTH << 8); } if (avctx->profile == FF_PROFILE_UNKNOWN) { @@ -587,9 +589,7 @@ static av_cold int prores_encode_close(AVCodecContext *avctx) { ProresContext* ctx = avctx->priv_data; av_freep(&avctx->coded_frame); - av_free(ctx->fill_y); - av_free(ctx->fill_u); - av_free(ctx->fill_v); + av_freep(&ctx->fill_y); return 0; } |