1
0
forked from aniani/vim

patch 8.2.3620: memory leak reported in libtlib

Problem:    Memory leak reported in libtlib.
Solution:   Call del_curterm() when cleaning up memory.  Rename term.h to
            termdefs.h to avoid a name clash.
This commit is contained in:
Bram Moolenaar
2021-11-19 11:28:04 +00:00
parent 777175b0df
commit b3a29558ee
12 changed files with 338 additions and 270 deletions

View File

@@ -2176,6 +2176,28 @@ set_termname(char_u *term)
return OK;
}
#if defined(EXITFREE) || defined(PROTO)
# ifdef HAVE_DEL_CURTERM
# undef TERMINAL // name clash in term.h
# include <term.h> // declares cur_term
# endif
/*
* If supported, delete "cur_term", which caches terminal related entries.
* Avoids that valgrind reports possibly lost memory.
*/
void
free_cur_term()
{
# ifdef HAVE_DEL_CURTERM
if (cur_term)
del_curterm(cur_term);
# endif
}
#endif
#ifdef HAVE_TGETENT
/*
* Call tgetent()