From 0c1fc0593ef5b918068709fd74d76e4824c90e7c Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 6 Jul 2017 02:02:25 +0200 Subject: [PATCH] Complementary fix to previous commit --- src/bin/common/color.c | 8 ++++---- src/lib/openjp2/openjpeg.c | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bin/common/color.c b/src/bin/common/color.c index 665558f5..185b547e 100644 --- a/src/bin/common/color.c +++ b/src/bin/common/color.c @@ -655,8 +655,8 @@ fails1: nr_samples = (size_t)(max * 3 * sizeof(unsigned char)); in = inbuf = (unsigned char*)opj_image_data_alloc(nr_samples); out = outbuf = (unsigned char*)opj_image_data_alloc(nr_samples); - g = (int*)calloc((size_t)max, sizeof(int)); - b = (int*)calloc((size_t)max, sizeof(int)); + g = (int*)opj_image_data_alloc((size_t)max * sizeof(int)); + b = (int*)opj_image_data_alloc((size_t)max * sizeof(int)); if (inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) { goto fails2; @@ -715,8 +715,8 @@ fails2: nr_samples = (size_t)(max * 3U * sizeof(unsigned short)); in = inbuf = (unsigned short*)opj_image_data_alloc(nr_samples); out = outbuf = (unsigned short*)opj_image_data_alloc(nr_samples); - g = (int*)calloc((size_t)max, sizeof(int)); - b = (int*)calloc((size_t)max, sizeof(int)); + g = (int*)opj_image_data_alloc((size_t)max * sizeof(int)); + b = (int*)opj_image_data_alloc((size_t)max * sizeof(int)); if (inbuf == NULL || outbuf == NULL || g == NULL || b == NULL) { goto fails3; diff --git a/src/lib/openjp2/openjpeg.c b/src/lib/openjp2/openjpeg.c index 8293a58d..4e649a74 100644 --- a/src/lib/openjp2/openjpeg.c +++ b/src/lib/openjp2/openjpeg.c @@ -1011,10 +1011,13 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream( void* OPJ_CALLCONV opj_image_data_alloc(OPJ_SIZE_T size) { - return opj_aligned_malloc(size); + void* ret = opj_aligned_malloc(size); + /* printf("opj_image_data_alloc %p\n", ret); */ + return ret; } void OPJ_CALLCONV opj_image_data_free(void* ptr) { + /* printf("opj_image_data_free %p\n", ptr); */ opj_aligned_free(ptr); }