Merge "vp8_init: fix NULL dereference on allocation error"

This commit is contained in:
James Zern 2013-03-04 11:10:06 -08:00 committed by Gerrit Code Review
commit a5762191d7

View File

@ -211,21 +211,19 @@ static vpx_codec_err_t vp8_init(vpx_codec_ctx_t *ctx,
mmap.flags = vp8_mem_req_segs[0].flags; mmap.flags = vp8_mem_req_segs[0].flags;
res = vp8_mmap_alloc(&mmap); res = vp8_mmap_alloc(&mmap);
if (res != VPX_CODEC_OK) return res;
if (!res) vp8_init_ctx(ctx, &mmap);
{
vp8_init_ctx(ctx, &mmap);
/* initialize number of fragments to zero */ /* initialize number of fragments to zero */
ctx->priv->alg_priv->fragments.count = 0; ctx->priv->alg_priv->fragments.count = 0;
/* is input fragments enabled? */ /* is input fragments enabled? */
ctx->priv->alg_priv->fragments.enabled = ctx->priv->alg_priv->fragments.enabled =
(ctx->priv->alg_priv->base.init_flags & (ctx->priv->alg_priv->base.init_flags &
VPX_CODEC_USE_INPUT_FRAGMENTS); VPX_CODEC_USE_INPUT_FRAGMENTS);
ctx->priv->alg_priv->defer_alloc = 1; ctx->priv->alg_priv->defer_alloc = 1;
/*post processing level initialized to do nothing */ /*post processing level initialized to do nothing */
}
} }
ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads = ctx->priv->alg_priv->yv12_frame_buffers.use_frame_threads =