aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-11-11 14:52:21 -0800
committerRuss Cox <rsc@golang.org>2009-11-11 14:52:21 -0800
commitae39a1d8ec1d476ea116c45210a507dca2192d19 (patch)
tree7141a99fc2e8f6b171e622d76da74102f4aa0b83
parentd38630fe3db1c5c916e496f19d47915f44eed92d (diff)
downloadgo-ae39a1d8ec1d476ea116c45210a507dca2192d19.tar.gz
go-ae39a1d8ec1d476ea116c45210a507dca2192d19.zip
cc: correct handling of allocn(0, 1, d)
Fixes #29. R=r https://golang.org/cl/152076
-rw-r--r--src/cmd/cc/lex.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/cc/lex.c b/src/cmd/cc/lex.c
index b3216af44d..ff80bfb324 100644
--- a/src/cmd/cc/lex.c
+++ b/src/cmd/cc/lex.c
@@ -1566,9 +1566,8 @@ alloc(int32 n)
void*
allocn(void *p, int32 n, int32 d)
{
-
if(p == nil)
- return alloc(d);
+ return alloc(n+d);
p = realloc(p, n+d);
if(p == nil) {
print("allocn out of mem\n");