lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi

In liolib.c the function read_file() allocates memory using realloc() 
and if there isn't enough memory it calls lua_error().
Isn't be better to free the previously allocated buffer before calls 
lua_error()? (realloc() doesn't free the buffer if it can't allocate 
new memory, or not?)
Sorry if I am wrong.

Out of curiosity: why read_file() calls realloc() and read_chars
()/openwithcontrol() calls malloc() instead of the luaM_ versions? To 
supply a specific error message?

Bye
Mauro