mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2026-01-03 11:08:55 -05:00
module: Always remove freed module from modules_pending_unload
pa_module_free is called from more than one place, not all of these places correctly removed the module from the modules_pending_unload array, potentially causing a dangling pointer in that array. Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
parent
83de5a0995
commit
a527711528
1 changed files with 3 additions and 2 deletions
|
|
@ -248,6 +248,8 @@ static void pa_module_free(pa_module *m) {
|
||||||
|
|
||||||
lt_dlclose(m->dl);
|
lt_dlclose(m->dl);
|
||||||
|
|
||||||
|
pa_hashmap_remove(m->core->modules_pending_unload, m);
|
||||||
|
|
||||||
pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
|
pa_log_info("Unloaded \"%s\" (index: #%u).", m->name, m->index);
|
||||||
|
|
||||||
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index);
|
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index);
|
||||||
|
|
@ -264,8 +266,6 @@ void pa_module_unload(pa_core *c, pa_module *m, bool force) {
|
||||||
if (m->core->disallow_module_loading && !force)
|
if (m->core->disallow_module_loading && !force)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pa_hashmap_remove(c->modules_pending_unload, m);
|
|
||||||
|
|
||||||
if (!(m = pa_idxset_remove_by_data(c->modules, m, NULL)))
|
if (!(m = pa_idxset_remove_by_data(c->modules, m, NULL)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -323,6 +323,7 @@ void pa_module_unload_all(pa_core *c) {
|
||||||
c->mainloop->defer_free(c->module_defer_unload_event);
|
c->mainloop->defer_free(c->module_defer_unload_event);
|
||||||
c->module_defer_unload_event = NULL;
|
c->module_defer_unload_event = NULL;
|
||||||
}
|
}
|
||||||
|
pa_assert(pa_hashmap_isempty(c->modules_pending_unload));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void defer_cb(pa_mainloop_api*api, pa_defer_event *e, void *userdata) {
|
static void defer_cb(pa_mainloop_api*api, pa_defer_event *e, void *userdata) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue