summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2016-05-10 22:08:49 +0200
committerMatthieu Darbois <mayeut@users.noreply.github.com>2016-05-10 22:08:49 +0200
commit4d2b6a671a0431722cd4845b246fe0a09f7ca934 (patch)
tree030585ea7603e95bde3f7cf603f9fc5be5d339ce /src
parentaae066debc29f6fe44bfcda1206bba0a68dfd00e (diff)
Update implementation of opj_calloc (#705)
Diffstat (limited to 'src')
-rw-r--r--src/lib/openjp2/opj_malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/openjp2/opj_malloc.c b/src/lib/openjp2/opj_malloc.c
index e04db912..4f8b1d6f 100644
--- a/src/lib/openjp2/opj_malloc.c
+++ b/src/lib/openjp2/opj_malloc.c
@@ -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);
}