Commit d9f4dc52 authored by Reimar Döffinger's avatar Reimar Döffinger

Only do 1 malloc instead of 3 and check for failure.

Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent 5c9b9165
...@@ -549,9 +549,11 @@ static av_cold int prores_encode_init(AVCodecContext *avctx) ...@@ -549,9 +549,11 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
} }
if ((avctx->height & 0xf) || (avctx->width & 0xf)) { if ((avctx->height & 0xf) || (avctx->width & 0xf)) {
ctx->fill_y = av_malloc(DEFAULT_SLICE_MB_WIDTH << 9); ctx->fill_y = av_malloc(4 * (DEFAULT_SLICE_MB_WIDTH << 8));
ctx->fill_u = av_malloc(DEFAULT_SLICE_MB_WIDTH << 8); if (!ctx->fill_y)
ctx->fill_v = av_malloc(DEFAULT_SLICE_MB_WIDTH << 8); 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) { if (avctx->profile == FF_PROFILE_UNKNOWN) {
...@@ -587,9 +589,7 @@ static av_cold int prores_encode_close(AVCodecContext *avctx) ...@@ -587,9 +589,7 @@ static av_cold int prores_encode_close(AVCodecContext *avctx)
{ {
ProresContext* ctx = avctx->priv_data; ProresContext* ctx = avctx->priv_data;
av_freep(&avctx->coded_frame); av_freep(&avctx->coded_frame);
av_free(ctx->fill_y); av_freep(&ctx->fill_y);
av_free(ctx->fill_u);
av_free(ctx->fill_v);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment