summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-07-06 02:02:25 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-08-07 18:32:52 +0200
commit0c1fc0593ef5b918068709fd74d76e4824c90e7c (patch)
treefce108f971e52632f3973fa4eacdd45f79a9c64c
parentf58aab9d6a57e48bdc60e15dd373c24de74719a9 (diff)
Complementary fix to previous commit
-rw-r--r--src/bin/common/color.c8
-rw-r--r--src/lib/openjp2/openjpeg.c5
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);
}