vim-patch:9.0.0785: memory leak with empty shell command

Problem:    Memory leak with empty shell command.
Solution:   Free the allocated memory when bailing out.

9652249a2d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-04-18 14:22:16 +08:00
parent c0f10d3fe0
commit 5b77dde8dd

View File

@ -1015,6 +1015,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
// 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) {
xfree(newcmd);
return;
}