Panic if Lua runs out of memory

This eliminates the most frequent class of Lua errors causing who knows
what to happen.
This commit is contained in:
Ilari Liusvaara 2011-09-24 13:43:17 +03:00
parent fb5d773339
commit 345daf2cc5

View file

@ -169,9 +169,12 @@ namespace
void* alloc(void* user, void* old, size_t olds, size_t news)
{
if(news)
return realloc(old, news);
else
if(news) {
void* m = realloc(old, news);
if(!m)
OOM_panic();
return m;
} else
free(old);
return NULL;
}