Skip to content

Commit

Permalink
make sure that SDL_malloc(0) or SDL_calloc(0,x) doesn't return NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Oct 12, 2017
1 parent 0ce23a5 commit bef0fec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/stdlib/SDL_malloc.c
Expand Up @@ -33,11 +33,17 @@

void *SDL_malloc(size_t size)
{
if (!size) {
return malloc(1);
}
return malloc(size);
}

void *SDL_calloc(size_t nmemb, size_t size)
{
if (!size || !nmemb) {
return calloc(1,1);
}
return calloc(nmemb, size);
}

Expand Down

0 comments on commit bef0fec

Please sign in to comment.