]> granicus.if.org Git - vim/commitdiff
patch 7.4.1868 v7.4.1868
authorBram Moolenaar <Bram@vim.org>
Wed, 1 Jun 2016 21:08:39 +0000 (23:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 1 Jun 2016 21:08:39 +0000 (23:08 +0200)
Problem:    Setting really_exiting causes memory leaks to be reported.
Solution:   Add the in_free_all_mem flag.

src/eval.c
src/globals.h
src/misc2.c
src/version.c

index 7b8a0ae9588d7e8515a72a451b5ddd563b9dfd99..50d1cbae8c3b8c15a21dda19505e6cb52a63bfa5 100644 (file)
@@ -25350,8 +25350,9 @@ func_unref(char_u *name)
        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)
index 5010cd4aee6a6e9294e6841a417cb89aaf421eb3..369eb546ec2046461e618cbb3330b18c629f81e0 100644 (file)
@@ -635,6 +635,10 @@ EXTERN int exiting INIT(= FALSE);
 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
index f7b1de30d5465ed92c2674f3904a6a7eff0848b9..ae6ca048d910a1ea4415074ee4f9c9b1e3bb6668 100644 (file)
@@ -1036,16 +1036,12 @@ static void free_findfile(void);
 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. */
index 8980b2d3d35db55583fffd7ca612b1588e305785..ea586106a3657cca2bafdccaee8ae2540c1cb2e7 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1868,
 /**/
     1867,
 /**/