diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-11 10:03:21 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-11 10:03:21 +0000 |
commit | 1bc6f594d3de8dbfb5c165835eaec99bd49327c8 (patch) | |
tree | d535a84c63a5cf779aa1ae83f89ed64f22040471 /gc.c | |
parent | 3f5b1ec9cb657375a0c467ac70fdd6fbdc97f018 (diff) |
1.1b9_25
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -47,10 +47,13 @@ static unsigned long malloc_memories = 0; void * xmalloc(size) - unsigned long size; + int size; { void *mem; + if (size < 0) { + ArgError("negative allocation size (or too big)"); + } if (size == 0) size = 1; #if 0 malloc_memories += size; @@ -71,7 +74,7 @@ xmalloc(size) void * xcalloc(n, size) - unsigned long n, size; + int n, size; { void *mem; @@ -84,10 +87,13 @@ xcalloc(n, size) void * xrealloc(ptr, size) void *ptr; - unsigned long size; + int size; { void *mem; + if (size < 0) { + ArgError("negative re-allocation size"); + } if (!ptr) return xmalloc(size); mem = realloc(ptr, size); if (!mem) { |