openjp2: Plug image leak when failing to allocate codestream index.

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

View File

@ -8293,6 +8293,8 @@ OPJ_BOOL opj_j2k_read_header(opj_stream_private_t *p_stream,
/*Allocate and initialize some elements of codestrem index*/
if (!opj_j2k_allocate_tile_element_cstr_index(p_j2k)) {
opj_image_destroy(*p_image);
*p_image = NULL;
return OPJ_FALSE;
}