]> granicus.if.org Git - vim/commitdiff
patch 8.1.0843: memory leak when running "make test_cd" v8.1.0843
authorBram Moolenaar <Bram@vim.org>
Tue, 29 Jan 2019 19:17:28 +0000 (20:17 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 29 Jan 2019 19:17:28 +0000 (20:17 +0100)
Problem:    Memory leak when running "make test_cd".
Solution:   Free the stack element when failing. (Dominique Pelle,
            closes #3877)

src/misc2.c
src/version.c

index ca8f56d384af4d0dc1b3947509023b56d1bfe95b..df3f8e169be3c942b5a5e9ac52cfb0aba7b8a8d5 100644 (file)
@@ -4657,7 +4657,10 @@ vim_findfile(void *search_ctx_arg)
                        add_pathsep(file_path);
                    }
                    else
+                   {
+                       ff_free_stack_element(stackp);
                        goto fail;
+                   }
                }
 
                /* append the fix part of the search path */
@@ -4667,7 +4670,10 @@ vim_findfile(void *search_ctx_arg)
                    add_pathsep(file_path);
                }
                else
+               {
+                   ff_free_stack_element(stackp);
                    goto fail;
+               }
 
 #ifdef FEAT_PATH_EXTRA
                rest_of_wildcards = stackp->ffs_wc_path;
@@ -4687,7 +4693,10 @@ vim_findfile(void *search_ctx_arg)
                            if (len + 1 < MAXPATHL)
                                file_path[len++] = '*';
                            else
+                           {
+                               ff_free_stack_element(stackp);
                                goto fail;
+                           }
                        }
 
                        if (*p == 0)
@@ -4718,7 +4727,10 @@ vim_findfile(void *search_ctx_arg)
                        if (len + 1 < MAXPATHL)
                            file_path[len++] = *rest_of_wildcards++;
                        else
+                       {
+                           ff_free_stack_element(stackp);
                            goto fail;
+                       }
 
                    file_path[len] = NUL;
                    if (vim_ispathsep(*rest_of_wildcards))
@@ -4787,7 +4799,10 @@ vim_findfile(void *search_ctx_arg)
                            STRCAT(file_path, search_ctx->ffsc_file_to_search);
                        }
                        else
+                       {
+                           ff_free_stack_element(stackp);
                            goto fail;
+                       }
 
                        /*
                         * Try without extra suffix and then with suffixes
index c8bb2f7de66cd4de659366e36ed5f411d815246d..e78fde7dfb38a78cf7fb441aa2109ecaa1803773 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    843,
 /**/
     842,
 /**/