Problem: readdir() allocates list twice.
Solution: Remove second allocation. Also check for zero length.
}
#endif
- rettv->vval.v_list = list_alloc();
- if (!failed && rettv->vval.v_list != NULL)
+ if (!failed && rettv->vval.v_list != NULL && ga.ga_len > 0)
{
- ++rettv->vval.v_list->lv_refcount;
sort_strings((char_u **)ga.ga_data, ga.ga_len);
for (i = 0; i < ga.ga_len; i++)
{
list_append_string(rettv->vval.v_list, p, -1);
}
}
- for (i = 0; i < ga.ga_len; i++)
- vim_free(((char_u **)ga.ga_data)[i]);
-
- ga_clear(&ga);
+ ga_clear_strings(&ga);
}
/*
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1186,
/**/
1185,
/**/