From 3cf340f676aea0d2f4a1135bf9aebc979f93d30a Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 11 Dec 2017 16:55:31 -0200 Subject: [PATCH] allows memory-allocation errors when shrinking blocks --- ltests.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ltests.c b/ltests.c index 88333528..3e9c82a0 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 2.234 2017/12/07 18:51:39 roberto Exp roberto $ +** $Id: ltests.c,v 2.235 2017/12/08 15:19:13 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -141,7 +141,7 @@ void *debug_realloc (void *ud, void *b, size_t oldsize, size_t size) { freeblock(mc, block); return NULL; } - if (mc->countlimit != ~0UL && size > oldsize) { /* count limit in use? */ + if (mc->countlimit != ~0UL && size > 0) { /* count limit in use? */ if (mc->countlimit == 0) return NULL; /* fake a memory allocation error */ mc->countlimit--; @@ -1001,6 +1001,7 @@ static int loadlib (lua_State *L) { {"math", luaopen_math}, {"string", luaopen_string}, {"table", luaopen_table}, + {"T", luaB_opentests}, {NULL, NULL} }; lua_State *L1 = getstate(L);