summaryrefslogtreecommitdiff
path: root/usr.bin/vi
diff options
context:
space:
mode:
authorPeter Valchev <pvalchev@cvs.openbsd.org>2005-01-08 05:18:53 +0000
committerPeter Valchev <pvalchev@cvs.openbsd.org>2005-01-08 05:18:53 +0000
commit021be0ce4540327d8a286e8cbec726576b34f97f (patch)
tree5eb9d508c0ea057cd1bb749a01f0fbd0b50b448d /usr.bin/vi
parent23e1909022c06e21addb4a17265e9f2060f9a622 (diff)
When an error occurs in v_txt(), leave input mode too.
Otherwise, (among other things) db_get() thinks it can re-use the TEXT buffers when it's not true, leading to a crash because that TEXT buffer will be released just before it is actually used to create a new one. From NetBSD, fixes NetBSD PR#21797.
Diffstat (limited to 'usr.bin/vi')
-rw-r--r--usr.bin/vi/vi/v_txt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/vi/vi/v_txt.c b/usr.bin/vi/vi/v_txt.c
index ab787db588d..a557906ccfa 100644
--- a/usr.bin/vi/vi/v_txt.c
+++ b/usr.bin/vi/vi/v_txt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: v_txt.c,v 1.13 2002/02/17 19:42:34 millert Exp $ */
+/* $OpenBSD: v_txt.c,v 1.14 2005/01/08 05:18:52 pvalchev Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -1458,6 +1458,7 @@ done: /* Leave input mode. */
err:
alloc_err:
+ F_CLR(sp, SC_TINPUT);
txt_err(sp, &sp->tiq);
return (1);
}