summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-10-17 20:00:26 +0100
committerBram Moolenaar <Bram@vim.org>2022-10-17 20:00:26 +0100
commit9652249a2d02318a28a63a7b5711f25652e8f969 (patch)
tree3b6ed750e0944859ce1d96e57c0a1d992f403c3f
parentb99e6e6c5fbabbade6431fb555c4fe7409a9269a (diff)
downloadvim-git-9652249a2d02318a28a63a7b5711f25652e8f969.tar.gz
patch 9.0.0785: memory leak with empty shell commandv9.0.0785
Problem: Memory leak with empty shell command. Solution: Free the allocated memory when bailing out.
-rw-r--r--src/ex_cmds.c3
-rw-r--r--src/version.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index f5271ea42..93f9dd700 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -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;
diff --git a/src/version.c b/src/version.c
index b912819a8..f3a7e293a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 785,
+/**/
784,
/**/
783,