diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-22 12:46:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-22 12:46:37 +0000 |
commit | 2b0fe572619727adcef6105885b5e9e14a7250da (patch) | |
tree | 9f6607abb1ec2017d89e4ae5d713f3f73d21ec8d /bin | |
parent | 86f0d598c3169b42fcd878daa478422c2f32a090 (diff) |
Fix growstackblock() 'newlen' calculations:
(1) it needs to be ALIGNed for both halves of the 'if,' and
(2) if you're going to claim that you now have ALIGN(newlen)
bytes left, you should have actually allocated
ALIGN(newlen), rather than just 'newlen' bytes.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/memalloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bin/sh/memalloc.c b/bin/sh/memalloc.c index 38ac0f0a895..95413253c59 100644 --- a/bin/sh/memalloc.c +++ b/bin/sh/memalloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: memalloc.c,v 1.16 1995/05/11 21:29:29 christos Exp $ */ +/* $NetBSD: memalloc.c,v 1.17 1996/05/20 14:49:32 cgd Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$NetBSD: memalloc.c,v 1.16 1995/05/11 21:29:29 christos Exp $"; +static char rcsid[] = "$NetBSD: memalloc.c,v 1.17 1996/05/20 14:49:32 cgd Exp $"; #endif #endif /* not lint */ @@ -211,7 +211,7 @@ popstackmark(mark) void growstackblock() { char *p; - int newlen = stacknleft * 2 + 100; + int newlen = ALIGN(stacknleft * 2 + 100); char *oldspace = stacknxt; int oldlen = stacknleft; struct stack_block *sp; @@ -230,7 +230,7 @@ growstackblock() { p = stalloc(newlen); memcpy(p, oldspace, oldlen); stacknxt = p; /* free the space */ - stacknleft += ALIGN(newlen); /* we just allocated */ + stacknleft += newlen; /* we just allocated */ } } |