diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-10-29 21:53:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-29 21:53:08 +0100 |
commit | 03d6e6f42b0deeb02d52c8a48c14abe431370c1c (patch) | |
tree | 293ef86f93e032c3111986f46ea7895ce30e89fb /src | |
parent | 1577537f109d97a975fda9a899cacfb598617767 (diff) | |
download | vim-git-03d6e6f42b0deeb02d52c8a48c14abe431370c1c.tar.gz |
patch 9.0.0820: memory leak with empty shell commandv9.0.0820
Problem: Memory leak with empty shell command.
Solution: Free the empty string.
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds.c | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 44333d514..7bb7aa038 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -957,12 +957,15 @@ do_bang( } } while (trailarg != NULL); - // Don't clear "prevcmd" if there is no command to run. + // Only set "prevcmd" if there is a command to run, otherwise keep te one + // we have. if (STRLEN(newcmd) > 0) { vim_free(prevcmd); prevcmd = newcmd; } + else + free_newcmd = TRUE; if (bangredo) // put cmd in redo buffer for ! command { @@ -986,6 +989,8 @@ do_bang( */ if (*p_shq != NUL) { + if (free_newcmd) + vim_free(newcmd); newcmd = alloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1); if (newcmd == NULL) return; diff --git a/src/version.c b/src/version.c index f9a00d632..2d2ae6aae 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 */ /**/ + 820, +/**/ 819, /**/ 818, |