diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-12-12 18:56:32 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-12 18:56:32 +0000 |
commit | 6342e2c5a6570231aefabd8e34c2f2cb22f6927a (patch) | |
tree | 68f2498cf9c05c16d55cd0d6953a1df65540c7f1 /src/vim9type.c | |
parent | 67578e5bcf7404d40d42876b738b72e68add1a3e (diff) |
patch 9.0.1050: using freed memory when assigning to variable twicev9.0.1050
Problem: Using freed memory when assigning to variable twice.
Solution: Make copy of the list type. (closes #11691)
Diffstat (limited to 'src/vim9type.c')
-rw-r--r-- | src/vim9type.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vim9type.c b/src/vim9type.c index f36fa5eea4..5d37ac5dce 100644 --- a/src/vim9type.c +++ b/src/vim9type.c @@ -403,7 +403,8 @@ typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int flags) if (l->lv_type != NULL && (l->lv_first == NULL || (flags & TVTT_MORE_SPECIFIC) == 0 || l->lv_type->tt_member != &t_any)) - return l->lv_type; + // make a copy, lv_type may be freed if the list is freed + return copy_type(l->lv_type, type_gap); if (l->lv_first == &range_list_item) return &t_list_number; if (l->lv_copyID == copyID) |