Patch 8.2.3294
Problem: Lua: memory leak when adding dict item fails.
Solution: Free the typval and the dict item.
Files: src/if_lua.c
*** ../vim-8.2.3293/src/if_lua.c 2021-08-05 15:11:04.577422906 +0200
--- src/if_lua.c 2021-08-05 16:45:35.675395624 +0200
***************
*** 1859,1870 ****
// Need to create an entry
di = dictitem_alloc((char_u *)name);
if (di == NULL)
return 0;
// Update the value
copy_tv(&tv, &di->di_tv);
if (dict_add(dict, di) == FAIL)
return luaL_error(L, "Couldn't add to dictionary");
! } else
{
// Clear the old value
clear_tv(&di->di_tv);
--- 1859,1878 ----
// Need to create an entry
di = dictitem_alloc((char_u *)name);
if (di == NULL)
+ {
+ clear_tv(&tv);
return 0;
+ }
// Update the value
copy_tv(&tv, &di->di_tv);
if (dict_add(dict, di) == FAIL)
+ {
+ dictitem_free(di);
+ clear_tv(&tv);
return luaL_error(L, "Couldn't add to dictionary");
! }
! }
! else
{
// Clear the old value
clear_tv(&di->di_tv);
*** ../vim-8.2.3293/src/version.c 2021-08-05 16:23:05.482890089 +0200
--- src/version.c 2021-08-05 16:46:34.131267934 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3294,
/**/
--
MORTICIAN: Bring out your dead!
[clang]
Bring out your dead!
[clang]
Bring out your dead!
CUSTOMER: Here's one -- nine pence.
DEAD PERSON: I'm not dead!
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202108051448.175EmRJG1321265%40masaka.moolenaar.net.