module-session-manager: don't leak the impl structure

We need to remove the listener for the object as well so that we
can safely free the impl memory.
This commit is contained in:
Wim Taymans 2021-10-27 17:41:32 +02:00
parent 2112a7287b
commit 3509962f3a
3 changed files with 6 additions and 0 deletions

View file

@ -221,6 +221,7 @@ static void global_destroy(void *data)
impl->global = NULL;
if (impl->resource)
pw_resource_destroy(impl->resource);
free(impl);
}
static const struct pw_global_events global_events = {
@ -234,6 +235,7 @@ static void impl_resource_destroy(void *data)
struct param_data *pdata, *tmp;
spa_hook_remove(&impl->resource_listener);
spa_hook_remove(&impl->link_listener);
impl->resource = NULL;
/* clear cache */

View file

@ -212,6 +212,7 @@ static void global_destroy(void *data)
impl->global = NULL;
if (impl->resource)
pw_resource_destroy(impl->resource);
free(impl);
}
static const struct pw_global_events global_events = {
@ -225,6 +226,7 @@ static void impl_resource_destroy(void *data)
struct param_data *pdata, *tmp;
spa_hook_remove(&impl->resource_listener);
spa_hook_remove(&impl->stream_listener);
impl->resource = NULL;
/* clear cache */

View file

@ -221,6 +221,7 @@ static void global_destroy(void *data)
impl->global = NULL;
if (impl->resource)
pw_resource_destroy(impl->resource);
free(impl);
}
static const struct pw_global_events global_events = {
@ -234,6 +235,7 @@ static void impl_resource_destroy(void *data)
struct param_data *pdata, *tmp;
spa_hook_remove(&impl->resource_listener);
spa_hook_remove(&impl->endpoint_listener);
impl->resource = NULL;
/* clear cache */