]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Prevent a leak when reading PPT markers
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 14 Mar 2014 12:27:01 +0000 (12:27 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Fri, 14 Mar 2014 12:27:01 +0000 (12:27 +0000)
Update issue 295

src/lib/openjp2/j2k.c

index 7a714f9bd23cca88e215d20f9c358fec10723bfa..93d9999c606c6d2cead303310beecf0996763438 100644 (file)
@@ -3803,6 +3803,7 @@ static OPJ_BOOL opj_j2k_read_ppt (  opj_j2k_t *p_j2k,
                 l_tcp->ppt_data_size = 0;
                 l_tcp->ppt_len = p_header_size;
 
+                opj_free(l_tcp->ppt_buffer);
                 l_tcp->ppt_buffer = (OPJ_BYTE *) opj_calloc(l_tcp->ppt_len, sizeof(OPJ_BYTE) );
                 if (l_tcp->ppt_buffer == 00) {
                         opj_event_msg(p_manager, EVT_ERROR, "Not enough memory to read PPT marker\n");