Fix crash on Windows by using opj_image_data_free instead of opj_free for image->comps[].data
This commit is contained in:
parent
5abd86b14b
commit
73f65d333b
|
@ -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);
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue