Fix crash on Windows by using opj_image_data_free instead of opj_free for image->comps[].data

This commit is contained in:
trylab 2017-09-08 10:43:22 +08:00
parent dab5b72c1b
commit dab9db0723
3 changed files with 3 additions and 3 deletions

View File

@ -180,7 +180,7 @@ void opj_copy_image_header(const opj_image_t* p_image_src,
for (compno = 0; compno < p_image_dest->numcomps; compno++) { for (compno = 0; compno < p_image_dest->numcomps; compno++) {
opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]); opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]);
if (image_comp->data) { if (image_comp->data) {
opj_free(image_comp->data); opj_image_data_free(image_comp->data);
} }
} }
opj_free(p_image_dest->comps); opj_free(p_image_dest->comps);

View File

@ -1083,7 +1083,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image,
if (!new_comps[i].data) { if (!new_comps[i].data) {
while (i > 0) { while (i > 0) {
-- i; -- i;
opj_free(new_comps[i].data); opj_image_data_free(new_comps[i].data);
} }
opj_free(new_comps); opj_free(new_comps);
opj_event_msg(p_manager, EVT_ERROR, opj_event_msg(p_manager, EVT_ERROR,

View File

@ -426,7 +426,7 @@ static void jp2_apply_pclr(opj_jp2_color_t *color, opj_image_t *image,
max = image->numcomps; max = image->numcomps;
for (i = 0; i < max; ++i) { for (i = 0; i < max; ++i) {
if (old_comps[i].data) { if (old_comps[i].data) {
opj_free(old_comps[i].data); opj_image_data_free(old_comps[i].data);
} }
} }
opj_free(old_comps); opj_free(old_comps);