mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
pipewire: module-filter-chain: fix buffer memory leaks
`impl::{silence_data,discard_data}` were not freed either
in case of an initialization error or graceful shutdown.
This commit is contained in:
parent
2738bb4cb7
commit
aa681365c3
1 changed files with 13 additions and 0 deletions
|
|
@ -2858,6 +2858,9 @@ static void impl_destroy(struct impl *impl)
|
||||||
graph_free(&impl->graph);
|
graph_free(&impl->graph);
|
||||||
spa_list_consume(pl, &impl->plugin_func_list, link)
|
spa_list_consume(pl, &impl->plugin_func_list, link)
|
||||||
free_plugin_func(pl);
|
free_plugin_func(pl);
|
||||||
|
|
||||||
|
free(impl->silence_data);
|
||||||
|
free(impl->discard_data);
|
||||||
free(impl);
|
free(impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2978,8 +2981,18 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||||
impl->quantum_limit = pw_properties_get_uint32(
|
impl->quantum_limit = pw_properties_get_uint32(
|
||||||
pw_context_get_properties(impl->context),
|
pw_context_get_properties(impl->context),
|
||||||
"default.clock.quantum-limit", 8192u);
|
"default.clock.quantum-limit", 8192u);
|
||||||
|
|
||||||
impl->silence_data = calloc(impl->quantum_limit, sizeof(float));
|
impl->silence_data = calloc(impl->quantum_limit, sizeof(float));
|
||||||
|
if (impl->silence_data == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
impl->discard_data = calloc(impl->quantum_limit, sizeof(float));
|
impl->discard_data = calloc(impl->quantum_limit, sizeof(float));
|
||||||
|
if (impl->discard_data == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
cpu_iface = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
cpu_iface = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
impl->dsp.cpu_flags = cpu_iface ? spa_cpu_get_flags(cpu_iface) : 0;
|
impl->dsp.cpu_flags = cpu_iface ? spa_cpu_get_flags(cpu_iface) : 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue