opj_jp2_apply_pclr() also needs to use opj_image_data_alloc/opj_image_data_free

This commit is contained in:
Even Rouault 2017-07-06 02:17:26 +02:00
parent 0c1fc0593e
commit 434ace4ff7
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}