vim-patch:7.4.2197

Problem:    All functions are freed on exit, which may hide leaks.
Solution:   Only free named functions, not reference counted ones.

c257487035
This commit is contained in:
Michael Ennen 2016-12-16 15:16:55 -07:00
parent e2f76d190d
commit 8cae66b5e0
2 changed files with 14 additions and 5 deletions

View File

@ -21781,11 +21781,15 @@ ufunc_T *find_func(char_u *name)
void free_all_functions(void)
{
hashitem_T *hi;
ufunc_T *fp;
uint64_t skipped = 0;
uint64_t todo;
/* Need to start all over every time, because func_free() may change the
* hash table. */
while (func_hashtab.ht_used > 0)
for (hi = func_hashtab.ht_array;; ++hi)
// Need to start all over every time, because func_free() may change the
// hash table.
while (func_hashtab.ht_used > skipped) {
todo = func_hashtab.ht_used;
for (hi = func_hashtab.ht_array; todo > 0; hi++) {
if (!HASHITEM_EMPTY(hi)) {
todo--;
// Only free functions that are not refcounted, those are
@ -21800,6 +21804,11 @@ void free_all_functions(void)
}
}
}
}
if (skipped == 0) {
hash_clear(&func_hashtab);
}
}
#endif

View File

@ -243,7 +243,7 @@ static int included_patches[] = {
// 2200,
// 2199 NA
// 2198 NA
// 2197,
2197,
// 2196,
// 2195 NA
2194,