mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: fix memory issue
Previously, when `pw_protocol_pulse_new()` returned NULL, the code would jump to the `error` label, which would call `impl_free()`. At this point, however, `impl->module_listener` is not initialized, which would lead to a SIGSEGV when `spa_hook_remove()` is called from `impl_free()`.
This commit is contained in:
parent
8e36353311
commit
1e9442e6b8
1 changed files with 2 additions and 4 deletions
|
|
@ -99,7 +99,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||||
impl->pulse = pw_protocol_pulse_new(context, props, 0);
|
impl->pulse = pw_protocol_pulse_new(context, props, 0);
|
||||||
if (impl->pulse == NULL) {
|
if (impl->pulse == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
goto error;
|
free(impl);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
||||||
|
|
@ -107,7 +108,4 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||||
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
|
||||||
impl_free(impl);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue