Complementary fix to previous commit

This commit is contained in:
Even Rouault 2017-07-06 02:02:25 +02:00
parent f58aab9d6a
commit 0c1fc0593e
2 changed files with 8 additions and 5 deletions

View File

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

View File

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