openjp2: Plug image leak when failing to allocate codestream index. 1260/head
authorSebastian Rasmussen <sebras@gmail.com>
Mon, 22 Jun 2020 18:18:19 +0000 (02:18 +0800)
committerSebastian Rasmussen <sebras@gmail.com>
Mon, 22 Jun 2020 19:42:25 +0000 (03:42 +0800)
This fixes issue #1259.

src/lib/openjp2/j2k.c

index c45b6742e97a5c0c119e36b9008f1ad80fceca90..4a4fd16cbd8c45284a4042792982a1b244ed32ef 100644 (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;
     }