aboutsummaryrefslogtreecommitdiff
path: root/lmem.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-11 10:27:48 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-11 10:27:48 -0200
commitc5ebed73997c118306e548ac5ccb98302dbf90e4 (patch)
treede09effd114653d4e8e0a337c357c2b033973890 /lmem.c
parente663a24ab03a54fa221c20a793812e5c5ffdf94f (diff)
downloadlua-c5ebed73997c118306e548ac5ccb98302dbf90e4.tar.gz
lua-c5ebed73997c118306e548ac5ccb98302dbf90e4.tar.bz2
lua-c5ebed73997c118306e548ac5ccb98302dbf90e4.zip
'luaM_shrinkvector' raises an error if it cannot shrink the block
(several parts of Lua use array size in protos as proxies for number of valid elements)
Diffstat (limited to 'lmem.c')
-rw-r--r--lmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lmem.c b/lmem.c
index afacbb9f..ecafef49 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.93 2017/12/07 18:59:52 roberto Exp roberto $ 2** $Id: lmem.c,v 1.94 2017/12/08 17:28:25 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -89,7 +89,7 @@ void *luaM_shrinkvector_ (lua_State *L, void *block, int *size,
89 lua_assert(newsize <= oldsize); 89 lua_assert(newsize <= oldsize);
90 newblock = (*g->frealloc)(g->ud, block, oldsize, newsize); 90 newblock = (*g->frealloc)(g->ud, block, oldsize, newsize);
91 if (newblock == NULL && final_n > 0) /* allocation failed? */ 91 if (newblock == NULL && final_n > 0) /* allocation failed? */
92 return block; /* keep old block */ 92 luaM_error(L);
93 else { 93 else {
94 g->GCdebt += newsize - oldsize; 94 g->GCdebt += newsize - oldsize;
95 *size = final_n; 95 *size = final_n;