diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2008-10-09 21:14:59 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2008-10-09 21:14:59 +0000 |
commit | a7ceaaeceb4391b22a774303c90a233a275a2ede (patch) | |
tree | 0ee0cc52985b9e978f15ad82c662be54ff5416a5 | |
parent | 1c0ed465609e58caba31e75d241d0f467fcca12e (diff) |
Now that len is set later in compile_subst() we need to move the
xmalloc call that goes with it.
-rw-r--r-- | usr.bin/sed/compile.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c index 082622b15aa..5af4f8f62e5 100644 --- a/usr.bin/sed/compile.c +++ b/usr.bin/sed/compile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: compile.c,v 1.26 2008/10/09 16:40:56 millert Exp $ */ +/* $OpenBSD: compile.c,v 1.27 2008/10/09 21:14:58 millert Exp $ */ /*- * Copyright (c) 1992 Diomidis Spinellis. @@ -35,7 +35,7 @@ #ifndef lint /* from: static char sccsid[] = "@(#)compile.c 8.2 (Berkeley) 4/28/95"; */ -static const char rcsid[] = "$OpenBSD: compile.c,v 1.26 2008/10/09 16:40:56 millert Exp $"; +static const char rcsid[] = "$OpenBSD: compile.c,v 1.27 2008/10/09 21:14:58 millert Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -463,9 +463,6 @@ compile_subst(char *p, struct s_subst *s) char c, *text, *op, *sp; int sawesc = 0; - if (!lbuf) - lbuf = xmalloc(len); - c = *p++; /* Terminator character */ if (c == '\0') return (NULL); @@ -473,6 +470,9 @@ compile_subst(char *p, struct s_subst *s) len = strlen(p); if (len < _POSIX2_LINE_MAX) len = _POSIX2_LINE_MAX; + if (!lbuf) + lbuf = xmalloc(len); + s->maxbref = 0; s->linenum = linenum; asize = 2 * len + 1; |