diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-09-05 16:57:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-09-05 16:57:08 -0300 |
commit | 728fa167d2c9da6be897b194d1693ecf3b829d89 (patch) | |
tree | c922b775c864ca128093a18c10eea026ec7fe537 | |
parent | 1bdde38bd24b137a240aede92363837e3d1a79b9 (diff) | |
download | lua-728fa167d2c9da6be897b194d1693ecf3b829d89.tar.gz lua-728fa167d2c9da6be897b194d1693ecf3b829d89.tar.bz2 lua-728fa167d2c9da6be897b194d1693ecf3b829d89.zip |
cannot raise memory error when realloc to smaller block
-rw-r--r-- | ltests.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.133 2002/08/06 18:01:50 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.134 2002/08/30 19:09:21 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -103,7 +103,7 @@ void *debug_realloc (void *block, size_t oldsize, size_t size) { | |||
103 | freeblock(block); | 103 | freeblock(block); |
104 | return NULL; | 104 | return NULL; |
105 | } | 105 | } |
106 | else if (memdebug_total+size-oldsize > memdebug_memlimit) | 106 | else if (size > oldsize && memdebug_total+size-oldsize > memdebug_memlimit) |
107 | return NULL; /* to test memory allocation errors */ | 107 | return NULL; /* to test memory allocation errors */ |
108 | else { | 108 | else { |
109 | void *newblock; | 109 | void *newblock; |