aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2007-07-06 16:34:56 +0000
committerXin LI <delphij@FreeBSD.org>2007-07-06 16:34:56 +0000
commit870945d8300e2d3f5e1bb4266c5463665f44e784 (patch)
tree3005001006df17d68055831eb5aa5037d5d11bb0 /usr.bin
parent49d8ecb49ef9de55eb0d87408f0ea05137c2cdde (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sed/compile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/sed/compile.c b/usr.bin/sed/compile.c
index a354e4e2fa07..635e058eac67 100644
--- a/usr.bin/sed/compile.c
+++ b/usr.bin/sed/compile.c
@@ -318,19 +318,19 @@ nonsel: /* Now parse the command */
errx(1,
"%lu: %s: substitute pattern can not be delimited by newline or backslash",
linenum, fname);
- if ((cmd->u.s = malloc(sizeof(struct s_subst))) == NULL)
+ if ((cmd->u.s = calloc(1, sizeof(struct s_subst))) == NULL)
err(1, "malloc");
p = compile_delimited(p, re);
if (p == NULL)
errx(1,
"%lu: %s: unterminated substitute pattern", linenum, fname);
+ --p;
+ p = compile_subst(p, cmd->u.s);
+ p = compile_flags(p, cmd->u.s);
if (*re == '\0')
cmd->u.s->re = NULL;
else
cmd->u.s->re = compile_re(re, cmd->u.s->icase);
- --p;
- p = compile_subst(p, cmd->u.s);
- p = compile_flags(p, cmd->u.s);
EATSPACE();
if (*p == ';') {
p++;