diff --git a/src/hlua.c b/src/hlua.c index a52a1b50dd..8ad9e9f4a3 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -8640,6 +8640,9 @@ static void *hlua_alloc(void *ud, void *ptr, size_t osize, size_t nsize) struct hlua_mem_allocator *zone = ud; size_t limit, old, new; + if (unlikely(!ptr && !nsize)) + return NULL; + /* a limit of ~0 means unlimited and boot complete, so there's no need * for accounting anymore. */