Problem: Using freed memory when declaration fails. (Yegappan Lakshmanan)
Solution: After unreferencing an object set the reference to NULL.
assert_equal('make = 123', c2.GetMake())
END
v9.CheckScriptSuccess(lines)
+
+ lines =<< trim END
+ vim9script
+
+ class MyCar
+ this.make: string
+
+ def new(make_arg: string)
+ this.make = make_arg
+ enddef
+ endclass
+
+ var c = MyCar.new("abc")
+ var c = MyCar.new("def")
+ END
+ v9.CheckScriptFailure(lines, 'E1041:')
enddef
def Test_class_member_access()
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:
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1095,
/**/
1094,
/**/