From ae39a1d8ec1d476ea116c45210a507dca2192d19 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 11 Nov 2009 14:52:21 -0800 Subject: [PATCH] cc: correct handling of allocn(0, 1, d) Fixes #29. R=r https://golang.org/cl/152076 --- src/cmd/cc/lex.c | 3 +-- 1 file changed, 1 insertion(+), 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");