summaryrefslogtreecommitdiffstats
path: root/m_config.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-06 03:01:36 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-06 06:47:38 +0300
commit9298acdd605c49eeec6e8b6dc4b2a33b2aab40b5 (patch)
tree11925301a5c0e804fdcbec7f230131c54eef188e /m_config.c
parent39e373aa8d2341e6ae81db1787981bc952a1b156 (diff)
downloadmpv-9298acdd605c49eeec6e8b6dc4b2a33b2aab40b5.tar.bz2
mpv-9298acdd605c49eeec6e8b6dc4b2a33b2aab40b5.tar.xz
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.
Diffstat (limited to 'm_config.c')
-rw-r--r--m_config.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/m_config.c b/m_config.c
index fcf86e785f..47e893717c 100644
--- a/m_config.c
+++ b/m_config.c
@@ -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);