Fix a bunch of obvious memory leaks at termination
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -430,13 +430,18 @@ out:
|
||||
}
|
||||
|
||||
void
|
||||
color_pair_cache_reset(void)
|
||||
color_pair_cache_free(void)
|
||||
{
|
||||
if (cache.pairs) {
|
||||
free(cache.pairs);
|
||||
memset(&cache, 0, sizeof(cache));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_pair_cache_reset(void)
|
||||
{
|
||||
color_pair_cache_free();
|
||||
/*
|
||||
* COLOR_PAIRS is actually not a macro and is thus not a
|
||||
* compile-time constant
|
||||
|
||||
@@ -61,5 +61,7 @@ int color_pair_cache_hash_str(const char* str, color_profile profile);
|
||||
int color_pair_cache_get(const char* pair_name);
|
||||
/* clear cache */
|
||||
void color_pair_cache_reset(void);
|
||||
/* free cache */
|
||||
void color_pair_cache_free(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -251,6 +251,7 @@ theme_list(void)
|
||||
void
|
||||
theme_close(void)
|
||||
{
|
||||
color_pair_cache_free();
|
||||
if (theme) {
|
||||
g_key_file_free(theme);
|
||||
theme = NULL;
|
||||
|
||||
Reference in New Issue
Block a user