1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-31 11:42:14 +00:00

options: free option defaults when freeing config

Possibly read-only default values of option variables are replaced
with dynamically allocated defaults when registering options. Free
these when freeing the overall config object on exit to clean up leak
report results.
This commit is contained in:
Uoti Urpala 2011-07-06 03:01:36 +03:00
parent 39e373aa8d
commit 9298acdd60

View File

@ -216,6 +216,11 @@ void m_config_free(struct m_config *config)
for (copt = config->opts; copt; copt = copt->next) {
if (copt->flags & M_CFG_OPT_ALIAS)
continue;
if (copt->opt->type->flags & M_OPT_TYPE_DYNAMIC) {
void *ptr = m_option_get_ptr(copt->opt, config->optstruct);
if (ptr)
m_option_free(copt->opt, ptr);
}
struct m_config_save_slot *sl;
for (sl = copt->slots; sl; sl = sl->prev)
m_option_free(copt->opt, sl->data);