patch 8.2.0974: Vim9: memory leak when script var has wrong type
Problem: Vim9: memory leak when script var has wrong type.
Solution: Free the variable name.
diff --git a/src/vim9script.c b/src/vim9script.c
index 13a29ec..6501684 100644
--- a/src/vim9script.c
+++ b/src/vim9script.c
@@ -477,7 +477,10 @@
p = skipwhite(p + 1);
type = parse_type(&p, &si->sn_type_list);
if (called_emsg != called_emsg_before)
+ {
+ vim_free(name);
return p;
+ }
// Create the variable with 0/NULL value.
CLEAR_FIELD(init_tv);