From bd67b746432b8a3fa81e5410776d95c2d63e90fc Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Tue, 26 Apr 2016 16:28:57 +0530 Subject: [PATCH] Decoder: Increment p_ctxt_inc_mb_map immediately after allocation This is needed to ensure free does not get a wrong address in case of allocation failure. Change-Id: I1818f2a8ae3cce8dd4e2293510ff63e617b83c5f --- decoder/ih264d_utils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c index acca990..641be45 100644 --- a/decoder/ih264d_utils.c +++ b/decoder/ih264d_utils.c @@ -1906,6 +1906,10 @@ WORD16 ih264d_allocate_dynamic_bufs(dec_struct_t * ps_dec) RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->p_ctxt_inc_mb_map = pv_buf; + /* 0th entry of CtxtIncMbMap will be always be containing default values + for CABAC context representing MB not available */ + ps_dec->p_ctxt_inc_mb_map += 1; + size = (sizeof(mv_pred_t) * ps_dec->u1_recon_mb_grp * 16); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); @@ -2088,9 +2092,6 @@ WORD16 ih264d_allocate_dynamic_bufs(dec_struct_t * ps_dec) RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_pic_buf_base = pv_buf; - /* 0th entry of CtxtIncMbMap will be always be containing default values - for CABAC context representing MB not available */ - ps_dec->p_ctxt_inc_mb_map += 1; /* Post allocation Increment Actions */ /***************************************************************************/