From 73f65d333b59a157ccb34cf653cdb4cc81b76409 Mon Sep 17 00:00:00 2001 From: trylab <494467347@qq.com> Date: Fri, 8 Sep 2017 14:31:29 +0800 Subject: [PATCH] Fix crash on Windows by using opj_image_data_free instead of opj_free for image->comps[].data --- src/lib/openjp2/image.c | 2 +- src/lib/openjp2/jp2.c | 2 +- src/lib/openmj2/jp2.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/openjp2/image.c b/src/lib/openjp2/image.c index e29172b2..bf7a7019 100644 --- a/src/lib/openjp2/image.c +++ b/src/lib/openjp2/image.c @@ -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++) { opj_image_comp_t *image_comp = &(p_image_dest->comps[compno]); if (image_comp->data) { - opj_free(image_comp->data); + opj_image_data_free(image_comp->data); } } opj_free(p_image_dest->comps); diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index c747c909..84d39327 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -1083,7 +1083,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image, if (!new_comps[i].data) { while (i > 0) { -- i; - opj_free(new_comps[i].data); + opj_image_data_free(new_comps[i].data); } opj_free(new_comps); opj_event_msg(p_manager, EVT_ERROR, diff --git a/src/lib/openmj2/jp2.c b/src/lib/openmj2/jp2.c index d2ca41f0..b9bbde9b 100644 --- a/src/lib/openmj2/jp2.c +++ b/src/lib/openmj2/jp2.c @@ -426,7 +426,7 @@ static void jp2_apply_pclr(opj_jp2_color_t *color, opj_image_t *image, max = image->numcomps; for (i = 0; i < max; ++i) { if (old_comps[i].data) { - opj_free(old_comps[i].data); + opj_image_data_free(old_comps[i].data); } } opj_free(old_comps);