modules: handle some property allocation errors

This commit is contained in:
Wim Taymans 2026-05-06 13:17:41 +02:00
parent b66614063d
commit cc2c7cc591
2 changed files with 14 additions and 6 deletions

View file

@ -981,6 +981,8 @@ static int rule_matched(void *data, const char *location, const char *action,
if (spa_streq(action, "create-stream")) {
i->stream_props = pw_properties_copy(impl->stream_props);
if (i->stream_props == NULL)
return -errno;
pw_properties_update_string(i->stream_props, str, len);
@ -1026,6 +1028,8 @@ static int metadata_property(void *data, uint32_t id,
info.id = SPA_ID_INVALID;
info.on_demand_id = on_demand_id;
info.stream_props = pw_properties_copy(impl->stream_props);
if (info.stream_props == NULL)
return -errno;
pw_properties_update_string(info.stream_props, value, strlen(value));

View file

@ -975,14 +975,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
pw_log_debug("module %p: new %s", impl, args);
if (args)
props = pw_properties_new_string(args);
else
props = pw_properties_new(NULL, NULL);
impl->context = context;
impl->loop = pw_context_get_main_loop(context);
impl->props = props;
spa_list_init(&impl->server_list);
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
@ -991,6 +985,16 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
impl->work_queue = pw_context_get_work_queue(context);
if (args)
props = pw_properties_new_string(args);
else
props = pw_properties_new(NULL, NULL);
if (props == NULL) {
res = -errno;
goto error_free;
}
impl->props = props;
if ((res = parse_params(impl)) < 0)
goto error_free;