Merge pull request #1260 from sebras/fix-issue-1259
authorEven Rouault <even.rouault@spatialys.com>
Mon, 22 Jun 2020 20:35:44 +0000 (22:35 +0200)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2020 20:35:44 +0000 (22:35 +0200)
openjp2: Plug image leak when failing to allocate codestream index.

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;
     }