summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--options/m_config.c6
-rw-r--r--options/m_config.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 606e836d20..7237972660 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -1437,8 +1437,10 @@ bool m_config_is_in_group(struct m_config *config,
void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
const struct m_sub_options *group)
{
- assert(ta_parent); // without you'd necessarily leak memory
- struct m_config_cache *cache = m_config_cache_alloc(ta_parent, global, group);
+ struct m_config_cache *cache = m_config_cache_alloc(NULL, global, group);
+ // Make talloc_free(cache->opts) free the entire cache.
+ ta_set_parent(cache->opts, ta_parent);
+ ta_set_parent(cache, cache->opts);
return cache->opts;
}
diff --git a/options/m_config.h b/options/m_config.h
index 80aeaef789..79f17b9bbe 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -325,8 +325,6 @@ bool m_config_cache_update(struct m_config_cache *cache);
// Like m_config_cache_alloc(), but return the struct (m_config_cache->opts)
// directly, with no way to update the config. Basically this returns a copy
// with a snapshot of the current option values.
-// Warning: does currently not set the child as its own talloc root, which
-// means the only way to free the struct is by freeing ta_parent.
void *mp_get_config_group(void *ta_parent, struct mpv_global *global,
const struct m_sub_options *group);