Skip to content

Commit

Permalink
Update implementation of opj_calloc (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
stweil authored and mayeut committed May 10, 2016
1 parent aae066d commit 4d2b6a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/openjp2/opj_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 4d2b6a6

Please sign in to comment.