Patch 8.2.3429
Problem: Leaking memory when assigning to list or dict.
Solution: Free the list or dict type before overwriting it.
Files: src/vim9type.c, src/evalvars.c
*** ../vim-8.2.3428/src/vim9type.c 2021-08-28 14:58:40.886062766 +0200
--- src/vim9type.c 2021-09-11 22:09:55.695441588 +0200
***************
*** 258,264 ****
typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
{
type_T *type;
! type_T *member_type = &t_any;
int argcount = 0;
int min_argcount = 0;
--- 258,264 ----
typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int do_member)
{
type_T *type;
! type_T *member_type = NULL;
int argcount = 0;
int min_argcount = 0;
***************
*** 268,273 ****
--- 268,275 ----
return &t_bool;
if (tv->v_type == VAR_STRING)
return &t_string;
+ if (tv->v_type == VAR_BLOB)
+ return &t_blob;
if (tv->v_type == VAR_LIST)
{
*** ../vim-8.2.3428/src/evalvars.c 2021-09-07 22:12:15.489452165 +0200
--- src/evalvars.c 2021-09-11 23:05:12.216412102 +0200
***************
*** 3462,3470 ****
if (vim9script && type != NULL)
{
if (type->tt_type == VAR_DICT && dest_tv->vval.v_dict != NULL)
! dest_tv->vval.v_dict->dv_type = alloc_type(type);
else if (type->tt_type == VAR_LIST && dest_tv->vval.v_list != NULL)
! dest_tv->vval.v_list->lv_type = alloc_type(type);
}
// ":const var = value" locks the value
--- 3462,3482 ----
if (vim9script && type != NULL)
{
if (type->tt_type == VAR_DICT && dest_tv->vval.v_dict != NULL)
! {
! if (dest_tv->vval.v_dict->dv_type != type)
! {
! free_type(dest_tv->vval.v_dict->dv_type);
! dest_tv->vval.v_dict->dv_type = alloc_type(type);
! }
! }
else if (type->tt_type == VAR_LIST && dest_tv->vval.v_list != NULL)
! {
! if (dest_tv->vval.v_list->lv_type != type)
! {
! free_type(dest_tv->vval.v_list->lv_type);
! dest_tv->vval.v_list->lv_type = alloc_type(type);
! }
! }
}
// ":const var = value" locks the value
*** ../vim-8.2.3428/src/version.c 2021-09-11 21:14:16.830577302 +0200
--- src/version.c 2021-09-11 23:00:51.408611181 +0200
***************
*** 757,758 ****
--- 757,760 ----
{ /* Add new patch number below this line */
+ /**/
+ 3429,
/**/
--
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job.
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// 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/202109112108.18BL8CoK704327%40masaka.moolenaar.net.