aboutsummaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/misc1.c b/src/misc1.c
index 3f8a1b934a..dbe4064b47 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -3373,12 +3373,15 @@ void preserve_exit(void)
{
buf_T *buf;
- prepare_to_exit();
+ // Prevent repeated calls into this method.
+ if (really_exiting) {
+ exit(2);
+ }
- /* Setting this will prevent free() calls. That avoids calling free()
- * recursively when free() was invoked with a bad pointer. */
really_exiting = TRUE;
+ prepare_to_exit();
+
out_str(IObuff);
screen_start(); /* don't know where cursor is now */
out_flush();