Problem: memory leak in add_interface_from_super_class() in
src/vim9class.c
Solution: Free variable intf_name in the error case, decrement the
impl_gap grow array (Huihui Huang).
closes: #19629
Signed-off-by: Huihui Huang <625173@qq.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 136,
/**/
135,
/**/
return FALSE;
if (ga_grow(impl_gap, 1) == FAIL)
- return FALSE;
+ goto fail;
char_u **intf_names = (char_u **)impl_gap->ga_data;
intf_names[impl_gap->ga_len] = intf_name;
// Add the interface class to "intf_classes_gap"
if (ga_grow(intf_classes_gap, 1) == FAIL)
- return FALSE;
+ {
+ --impl_gap->ga_len;
+ goto fail;
+ }
class_T **intf_classes = (class_T **)intf_classes_gap->ga_data;
intf_classes[intf_classes_gap->ga_len] = ifcl;
++ifcl->class_refcount;
return TRUE;
+fail:
+ vim_free(intf_name);
+ return FALSE;
}
/*