openjp2: Plug memory leak when setting data as TLS fails.

Previously the Tier 1 handle was not freed when setting it as
TLS failed.

This fixes issue #1257.
This commit is contained in:
Sebastian Rasmussen 2020-06-23 02:18:19 +08:00
parent 98150d0942
commit 79b199a8fe
1 changed files with 8 additions and 1 deletions

View File

@ -1665,7 +1665,14 @@ static void opj_t1_clbl_decode_processor(void* user_data, opj_tls_t* tls)
opj_free(job); opj_free(job);
return; return;
} }
opj_tls_set(tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper); if (!opj_tls_set(tls, OPJ_TLS_KEY_T1, t1, opj_t1_destroy_wrapper)) {
opj_event_msg(job->p_manager, EVT_ERROR,
"Unable to set t1 handle as TLS\n");
opj_t1_destroy(t1);
*(job->pret) = OPJ_FALSE;
opj_free(job);
return;
}
} }
t1->mustuse_cblkdatabuffer = job->mustuse_cblkdatabuffer; t1->mustuse_cblkdatabuffer = job->mustuse_cblkdatabuffer;