]> granicus.if.org Git - vim/commitdiff
patch 9.0.0785: memory leak with empty shell command v9.0.0785
authorBram Moolenaar <Bram@vim.org>
Mon, 17 Oct 2022 19:00:26 +0000 (20:00 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 17 Oct 2022 19:00:26 +0000 (20:00 +0100)
Problem:    Memory leak with empty shell command.
Solution:   Free the allocated memory when bailing out.

src/ex_cmds.c
src/version.c

index f5271ea426652bfe9f2a38e59e79ba9878be322a..93f9dd700c64bfe2d86c71e107b590189de5bdd9 100644 (file)
@@ -960,7 +960,10 @@ do_bang(
     // Don't do anything if there is no command as there isn't really anything
     // useful in running "sh -c ''".  Avoids changing "prevcmd".
     if (STRLEN(newcmd) == 0)
+    {
+       vim_free(newcmd);
        return;
+    }
 
     vim_free(prevcmd);
     prevcmd = newcmd;
index b912819a8c3e11a62c26f1699fb8a4c8af851ca2..f3a7e293afbd1e0ded48db2782b2e9509a754ccc 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    785,
 /**/
     784,
 /**/