patch 7.4.1868
Problem:    Setting really_exiting causes memory leaks to be reported.
Solution:   Add the in_free_all_mem flag.
diff --git a/src/eval.c b/src/eval.c
index 7b8a0ae..50d1cba 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -25350,8 +25350,9 @@
 	fp = find_func(name);
 	if (fp == NULL)
 	{
-	    /* Ignore when invoked through free_all_mem(). */
-	    if (!really_exiting)
+#ifdef EXITFREE
+	    if (!entered_free_all_mem)
+#endif
 		EMSG2(_(e_intern2), "func_unref()");
 	}
 	else if (--fp->uf_refcount <= 0)
diff --git a/src/globals.h b/src/globals.h
index 5010cd4..369eb54 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -635,6 +635,10 @@
 EXTERN int	really_exiting INIT(= FALSE);
 				/* TRUE when we are sure to exit, e.g., after
 				 * a deadly signal */
+#if defined(EXITFREE)
+EXTERN int	entered_free_all_mem INIT(= FALSE);
+				/* TRUE when in or after free_all_mem() */
+#endif
 /* volatile because it is used in signal handler deathtrap(). */
 EXTERN volatile int full_screen INIT(= FALSE);
 				/* TRUE when doing full-screen output
diff --git a/src/misc2.c b/src/misc2.c
index f7b1de3..ae6ca04 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1036,16 +1036,12 @@
 free_all_mem(void)
 {
     buf_T	*buf, *nextbuf;
-    static int	entered = FALSE;
 
     /* When we cause a crash here it is caught and Vim tries to exit cleanly.
      * Don't try freeing everything again. */
-    if (entered)
+    if (entered_free_all_mem)
 	return;
-    entered = TRUE;
-
-    /* Set this flag to indicate some errors can be ignored. */
-    really_exiting = TRUE;
+    entered_free_all_mem = TRUE;
 
 # ifdef FEAT_AUTOCMD
     /* Don't want to trigger autocommands from here on. */
diff --git a/src/version.c b/src/version.c
index 8980b2d..ea58610 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1868,
+/**/
     1867,
 /**/
     1866,