mirror of
https://github.com/ittiam-systems/libhevc.git
synced 2026-08-14 23:02:35 +07:00
Merge "Decoder: Handle ps_codec_obj memory allocation failure gracefully" into mnc-dr-dev am: 59d29f3a42
am: 1232ed762a
Change-Id: I965edde742ee45cb1b213da84f8bb843b598ebdf
This commit is contained in:
commit
c3388332a1
1 changed files with 20 additions and 4 deletions
|
|
@ -2047,21 +2047,37 @@ WORD32 ihevcd_create(iv_obj_t *ps_codec_obj,
|
|||
void *pv_api_ip,
|
||||
void *pv_api_op)
|
||||
{
|
||||
|
||||
ihevcd_cxa_create_ip_t *ps_create_ip;
|
||||
ihevcd_cxa_create_op_t *ps_create_op;
|
||||
|
||||
WORD32 ret;
|
||||
codec_t *ps_codec;
|
||||
ps_create_ip = (ihevcd_cxa_create_ip_t *)pv_api_ip;
|
||||
ps_create_op = (ihevcd_cxa_create_op_t *)pv_api_op;
|
||||
|
||||
ps_create_op->s_ivd_create_op_t.u4_error_code = 0;
|
||||
|
||||
ps_codec_obj = NULL;
|
||||
ret = ihevcd_allocate_static_bufs(&ps_codec_obj, pv_api_ip, pv_api_op);
|
||||
|
||||
/* If allocation of some buffer fails, then free buffers allocated till then */
|
||||
if((IV_FAIL == ret) && (NULL != ps_codec_obj))
|
||||
if(IV_FAIL == ret)
|
||||
{
|
||||
ihevcd_free_static_bufs(ps_codec_obj);
|
||||
if(NULL != ps_codec_obj)
|
||||
{
|
||||
if(ps_codec_obj->pv_codec_handle)
|
||||
{
|
||||
ihevcd_free_static_bufs(ps_codec_obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
void (*pf_aligned_free)(void *pv_mem_ctxt, void *pv_buf);
|
||||
void *pv_mem_ctxt;
|
||||
|
||||
pf_aligned_free = ps_create_ip->s_ivd_create_ip_t.pf_aligned_free;
|
||||
pv_mem_ctxt = ps_create_ip->s_ivd_create_ip_t.pv_mem_ctxt;
|
||||
pf_aligned_free(pv_mem_ctxt, ps_codec_obj);
|
||||
}
|
||||
}
|
||||
ps_create_op->s_ivd_create_op_t.u4_error_code = IVD_MEM_ALLOC_FAILED;
|
||||
ps_create_op->s_ivd_create_op_t.u4_error_code = 1 << IVD_FATALERROR;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue