Update implementation of opj_calloc (#705)

This commit is contained in:
Stefan Weil 2016-05-10 22:08:49 +02:00 committed by Matthieu Darbois
parent aae066debc
commit 4d2b6a671a
1 changed files with 2 additions and 2 deletions

View File

@ -196,10 +196,10 @@ void * opj_malloc(size_t size)
}
void * opj_calloc(size_t num, size_t size)
{
if (size == 0U) { /* prevent implementation defined behavior of realloc */
if (num == 0 || size == 0) {
/* prevent implementation defined behavior of realloc */
return NULL;
}
/* according to C89 standard, num == 0 shall return a valid pointer */
return calloc(num, size);
}