0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.1095: using freed memory when declaration fails

Problem:    Using freed memory when declaration fails. (Yegappan Lakshmanan)
Solution:   After unreferencing an object set the reference to NULL.
This commit is contained in:
Bram Moolenaar
2022-12-25 19:31:36 +00:00
parent 9b99411b93
commit 6ef5471afa
3 changed files with 20 additions and 0 deletions

View File

@@ -162,9 +162,11 @@ clear_tv(typval_T *varp)
break;
case VAR_CLASS:
class_unref(varp->vval.v_class);
varp->vval.v_class = NULL;
break;
case VAR_OBJECT:
object_unref(varp->vval.v_object);
varp->vval.v_object = NULL;
break;
case VAR_UNKNOWN:
case VAR_ANY: