In eval8() located in src/eval.c, parse_type() is called at line 4837 to parse a <type> cast in Vim9 script, allocating type objects into type_list:
want_type = parse_type(arg, &type_list, NULL, NULL, TRUE);
The cleanup call clear_type_list(&type_list) at line 4887 is only reached when want_type != NULL && evaluate:
if (want_type != NULL && evaluate) { if (res == OK) { // ... type checking logic ... } clear_type_list(&type_list); }
When want_type != NULL but evaluate is false (the expression is being parsed but not evaluated), the entire block is skipped and clear_type_list() is never called. The types allocated by parse_type() into type_list are leaked.
Change the outer condition from want_type != NULL && evaluate to just want_type != NULL, so that clear_type_list(&type_list) is always called when types were allocated. The evaluate check is moved inward to guard only the type-checking logic that depends on it. The fix is included in this commit.
https://github.com/vim/vim/pull/19819
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()