From cc2c7cc5914331da50c6aa8ddb80e569065d66e1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 6 May 2026 13:17:41 +0200 Subject: [PATCH] modules: handle some property allocation errors --- src/modules/module-combine-stream.c | 4 ++++ src/modules/module-protocol-simple.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/modules/module-combine-stream.c b/src/modules/module-combine-stream.c index 4efef2117..1af2ccd22 100644 --- a/src/modules/module-combine-stream.c +++ b/src/modules/module-combine-stream.c @@ -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)); diff --git a/src/modules/module-protocol-simple.c b/src/modules/module-protocol-simple.c index 4bc26574d..7333863cf 100644 --- a/src/modules/module-protocol-simple.c +++ b/src/modules/module-protocol-simple.c @@ -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;