Be robust to failed allocations of job structures
This commit is contained in:
parent
69497d35c0
commit
7d3c7a345f
|
@ -679,6 +679,16 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* t
|
|||
opj_dwd_decode_h_job_t* job;
|
||||
|
||||
job = (opj_dwd_decode_h_job_t*) opj_malloc(sizeof(opj_dwd_decode_h_job_t));
|
||||
if( !job )
|
||||
{
|
||||
/* It would be nice to fallback to single thread case, but */
|
||||
/* unfortunately some jobs may be launched and have modified */
|
||||
/* tiledp, so it is not practical to recover from that error */
|
||||
/* FIXME event manager error callback */
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
opj_aligned_free(h.mem);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
job->h = h;
|
||||
job->dwt_1D = dwt_1D;
|
||||
job->rw = rw;
|
||||
|
@ -726,6 +736,16 @@ static OPJ_BOOL opj_dwt_decode_tile(opj_thread_pool_t* tp, opj_tcd_tilecomp_t* t
|
|||
opj_dwd_decode_v_job_t* job;
|
||||
|
||||
job = (opj_dwd_decode_v_job_t*) opj_malloc(sizeof(opj_dwd_decode_v_job_t));
|
||||
if( !job )
|
||||
{
|
||||
/* It would be nice to fallback to single thread case, but */
|
||||
/* unfortunately some jobs may be launched and have modified */
|
||||
/* tiledp, so it is not practical to recover from that error */
|
||||
/* FIXME event manager error callback */
|
||||
opj_thread_pool_wait_completion(tp, 0);
|
||||
opj_aligned_free(v.mem);
|
||||
return OPJ_FALSE;
|
||||
}
|
||||
job->v = v;
|
||||
job->dwt_1D = dwt_1D;
|
||||
job->rh = rh;
|
||||
|
|
|
@ -1689,6 +1689,11 @@ void opj_t1_decode_cblks( opj_thread_pool_t* tp,
|
|||
opj_t1_cblk_decode_processing_job_t* job;
|
||||
|
||||
job = (opj_t1_cblk_decode_processing_job_t*) opj_calloc(1, sizeof(opj_t1_cblk_decode_processing_job_t));
|
||||
if( !job )
|
||||
{
|
||||
*pret = OPJ_FALSE;
|
||||
return;
|
||||
}
|
||||
job->resno = resno;
|
||||
job->cblk = cblk;
|
||||
job->band = band;
|
||||
|
|
Loading…
Reference in New Issue