Some bugs with stack reallocation by 'luaF_close'

(Long time without testing with '-DHARDSTACKTESTS'...)
With the introduction of to-be-closed variables, calls to 'luaF_close'
can move the stack, but some call sites where keeping pointers to the
stack without correcting them.
This commit is contained in:
Roberto Ierusalimschy
2018-11-24 11:59:15 -02:00
parent 84e32ad2eb
commit 7e63d3da02
4 changed files with 17 additions and 17 deletions

View File

@@ -142,7 +142,7 @@ void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) {
freeblock(mc, block);
return NULL;
}
if (mc->countlimit != ~0UL && size > 0) { /* count limit in use? */
if (mc->countlimit != ~0UL && size != oldsize) { /* count limit in use? */
if (mc->countlimit == 0)
return NULL; /* fake a memory allocation error */
mc->countlimit--;