updated for version 7.0179
diff --git a/src/misc1.c b/src/misc1.c
index a5a1805..08cd20c 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -7952,6 +7952,10 @@
 
     prepare_to_exit();
 
+    /* Setting this will prevent free() calls.  That avoids calling free()
+     * recursively when free() was invoked with a bad pointer. */
+    really_exiting = TRUE;
+
     out_str(IObuff);
     screen_start();		    /* don't know where cursor is now */
     out_flush();