m_config: remove change callback before unintialization

We don't want m_config uninitialization to call random change callbacks.
This happens at the end of mp_destroy(), when almost everything else is
already destroyed, and the change callbacks would probably trigger UB
all over the place.

The change callbacks could be trigger by m_config_restore_backups(),
which is just used as a cheap way to free the remaining state. The worst
is that this depends on which options may still have been part of this
"backup" state, which depends on user input.

Probably never a practical problem, since the backup state is most
likely guaranteed to be empty before uninit is performed, but still.
This commit is contained in:
wm4 2019-11-30 17:33:29 +01:00
parent fa9a1ff0a0
commit cd9fe3a843
1 changed files with 1 additions and 0 deletions

View File

@ -447,6 +447,7 @@ static struct m_config_shadow *m_config_shadow_new(const struct m_sub_options *r
static void config_destroy(void *p)
{
struct m_config *config = p;
config->option_change_callback = NULL;
m_config_restore_backups(config);
talloc_free(config->cache);