summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/sed/process.c')
-rw-r--r--usr.bin/sed/process.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 654cf758ab8..cc31fcb57a3 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.33 2017/12/13 16:06:34 millert Exp $ */
+/* $OpenBSD: process.c,v 1.34 2018/11/14 10:59:33 martijn Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@@ -196,6 +196,7 @@ redirect:
if (!nflag && !pd)
OUT();
flush_appends();
+ finish_file();
exit(0);
case 'r':
if (appendx >= appendnum) {
@@ -312,10 +313,13 @@ applies(struct s_command *cp)
* Reset all inrange markers.
*/
void
-resetranges(void)
+resetstate(void)
{
struct s_command *cp;
+ free(HS.back);
+ memset(&HS, 0, sizeof(HS));
+
for (cp = prog; cp; cp = cp->code == '{' ? cp->u.c : cp->next)
if (cp->a2)
cp->inrange = 0;