}
if (! *l_current_data) {
/* LH: oddly enough, in this path, l_tile_len!=0.
- * TODO: If this was consistant, we could simplify the code to only use realloc(), as realloc(0,...) default to malloc(0,...).
+ * TODO: If this was consistent, we could simplify the code to only use realloc(), as realloc(0,...) default to malloc(0,...).
*/
*l_current_data = (OPJ_BYTE*) opj_malloc(p_j2k->m_specific_param.m_decoder.m_sot_length);
}
opj_write_bytes(l_current_data,l_mco_size-2,2); /* Lmco */
l_current_data += 2;
- opj_write_bytes(l_current_data,l_tcp->m_nb_mcc_records,1); /* Nmco : only one tranform stage*/
+ opj_write_bytes(l_current_data,l_tcp->m_nb_mcc_records,1); /* Nmco : only one transform stage*/
++l_current_data;
l_mcc_record = l_tcp->m_mcc_records;
return OPJ_FALSE;
}
- opj_read_bytes(p_header_data,&l_nb_stages,1); /* Nmco : only one tranform stage*/
+ opj_read_bytes(p_header_data,&l_nb_stages,1); /* Nmco : only one transform stage*/
++p_header_data;
if (l_nb_stages > 1) {
cstr_index->marknum = 0;
cstr_index->marker = (opj_marker_info_t*)
opj_calloc(cstr_index->maxmarknum, sizeof(opj_marker_info_t));
- if (!cstr_index-> marker)
+ if (!cstr_index-> marker) {
+ opj_free(cstr_index);
return NULL;
+ }
cstr_index->tile_index = NULL;
/* now copy this data into the tile component */
if (! opj_tcd_copy_tile_data(p_j2k->m_tcd,l_current_data,l_current_tile_size)) {
opj_event_msg(p_manager, EVT_ERROR, "Size mismatch between tile data and sent data." );
+ opj_free(l_current_data);
return OPJ_FALSE;
}
}
if (! opj_j2k_post_write_tile (p_j2k,p_stream,p_manager)) {
+ if (l_current_data) {
+ opj_free(l_current_data);
+ }
return OPJ_FALSE;
}
}