From: Even Rouault Date: Thu, 6 Jul 2017 00:17:26 +0000 (+0200) Subject: opj_jp2_apply_pclr() also needs to use opj_image_data_alloc/opj_image_data_free X-Git-Tag: v2.2.0~13^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=434ace4ff74cc3eee401d4d3c02668c1d85f2a0d;p=openjpeg opj_jp2_apply_pclr() also needs to use opj_image_data_alloc/opj_image_data_free --- diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index 1211ab5d..33a10d30 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -1065,7 +1065,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(opj_image_t *image, /* Palette mapping: */ new_comps[i].data = (OPJ_INT32*) - opj_malloc(old_comps[cmp].w * old_comps[cmp].h * sizeof(OPJ_INT32)); + opj_image_data_alloc(old_comps[cmp].w * old_comps[cmp].h * sizeof(OPJ_INT32)); if (!new_comps[i].data) { while (i > 0) { -- i; @@ -1119,7 +1119,7 @@ static OPJ_BOOL opj_jp2_apply_pclr(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); } }