From 9652249a2d02318a28a63a7b5711f25652e8f969 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 17 Oct 2022 20:00:26 +0100 Subject: 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. --- src/ex_cmds.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ex_cmds.c') diff --git a/src/ex_cmds.c b/src/ex_cmds.c index f5271ea426..93f9dd700c 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; -- cgit v1.2.3