patch 9.1.1331: Leaking memory with cmdcomplete()
Problem: Leaking memory with cmdcomplete()
(zeertzjq, after v9.1.1329)
Solution: free the memory (Girish Palya)
closes: #17190
Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 45f69bb..5b87d78 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -1244,7 +1244,10 @@
// Save cmdline before expansion
if (ccline->cmdbuff != NULL)
+ {
+ vim_free(cmdline_orig);
cmdline_orig = vim_strnsave(ccline->cmdbuff, ccline->cmdlen);
+ }
if (xp->xp_numfiles == -1)
{