diff --git a/src/modules/module-protocol-pulse/modules/module-device-restore.c b/src/modules/module-protocol-pulse/modules/module-device-restore.c index 5a8c8d680..a025ee13b 100644 --- a/src/modules/module-protocol-pulse/modules/module-device-restore.c +++ b/src/modules/module-protocol-pulse/modules/module-device-restore.c @@ -118,6 +118,8 @@ static void emit_event(struct subscribe *s, uint32_t type, uint32_t idx) { struct client *client = s->client; struct message *msg = message_alloc(client->impl, -1, 0); + if (msg == NULL) + return; pw_log_info("[%s] EVENT index:%u name:%s %d/%d", client->name, s->data->module->index, s->data->module->info->name, type, idx); @@ -161,7 +163,7 @@ static void manager_updated(void *data, struct pw_manager_object *object) } } -struct pw_manager_events manager_events = { +static const struct pw_manager_events manager_events = { PW_VERSION_MANAGER_EVENTS, .added = manager_updated, .updated = manager_updated, diff --git a/src/modules/module-protocol-pulse/modules/module-gsettings.c b/src/modules/module-protocol-pulse/modules/module-gsettings.c index 2b7648528..652736e78 100644 --- a/src/modules/module-protocol-pulse/modules/module-gsettings.c +++ b/src/modules/module-protocol-pulse/modules/module-gsettings.c @@ -115,6 +115,10 @@ static int load_group(struct module_gsettings_data *d, const struct info *info) return -errno; g->name = strdup(info->name); + if (g->name == NULL) { + free(g); + return -errno; + } g->module = module_create(d->module->impl, info->module[i], info->args[i]); if (g->module == NULL) { pw_log_info("can't create module:%s args:%s: %m", diff --git a/src/modules/module-protocol-pulse/modules/module-jackdbus-detect.c b/src/modules/module-protocol-pulse/modules/module-jackdbus-detect.c index cf07a7bcb..c0f87a894 100644 --- a/src/modules/module-protocol-pulse/modules/module-jackdbus-detect.c +++ b/src/modules/module-protocol-pulse/modules/module-jackdbus-detect.c @@ -86,13 +86,13 @@ static int module_jackdbus_detect_load(struct module *module) spa_json_builder_array_push(&b, "{"); pw_properties_serialize_dict(b.f, &data->props->dict, 0); - spa_json_builder_object_push(&b, "source.props", "{"); + spa_json_builder_object_push(&b, "source.props", "{"); pw_properties_serialize_dict(b.f, &data->source_props->dict, 0); - spa_json_builder_pop(&b, "}"); - spa_json_builder_object_push(&b, "sink.props", "{"); + spa_json_builder_pop(&b, "}"); + spa_json_builder_object_push(&b, "sink.props", "{"); pw_properties_serialize_dict(b.f, &data->sink_props->dict, 0); - spa_json_builder_pop(&b, "}"); - spa_json_builder_pop(&b, "}"); + spa_json_builder_pop(&b, "}"); + spa_json_builder_pop(&b, "}"); spa_json_builder_close(&b); data->mod = pw_context_load_module(module->impl->context, @@ -120,6 +120,10 @@ static int module_jackdbus_detect_unload(struct module *module) d->mod = NULL; } + pw_properties_free(d->props); + pw_properties_free(d->sink_props); + pw_properties_free(d->source_props); + return 0; } @@ -172,7 +176,7 @@ static int module_jackdbus_detect_prepare(struct module * const module) spa_zero(info); if ((res = module_args_to_audioinfo_keys(module->impl, props, NULL, NULL, "sink_channels", "sink_channel_map", &info)) < 0) { - return res; + goto out; } else { audioinfo_to_properties(&info, sink_props); } @@ -194,7 +198,7 @@ static int module_jackdbus_detect_prepare(struct module * const module) spa_zero(info); if ((res = module_args_to_audioinfo_keys(module->impl, props, NULL, NULL, "source_channels", "source_channel_map", &info)) < 0) { - return res; + goto out; } else { audioinfo_to_properties(&info, source_props); } diff --git a/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c b/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c index 76e6eebba..76487425e 100644 --- a/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c +++ b/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c @@ -199,8 +199,22 @@ out: return res; } +static const char* const valid_args[] = { + "sink", + "sink_input_properties", + "resampler_profile", + "fec_code", + "sess_latency_msec", + "local_ip", + "local_source_port", + "local_repair_port", + "local_control_port", + NULL +}; + DEFINE_MODULE_INFO(module_roc_sink_input) = { .name = "module-roc-sink-input", + .valid_args = valid_args, .prepare = module_roc_sink_input_prepare, .load = module_roc_sink_input_load, .unload = module_roc_sink_input_unload, diff --git a/src/modules/module-protocol-pulse/modules/module-rtp-recv.c b/src/modules/module-protocol-pulse/modules/module-rtp-recv.c index fc6e2491c..44b0ac13e 100644 --- a/src/modules/module-protocol-pulse/modules/module-rtp-recv.c +++ b/src/modules/module-protocol-pulse/modules/module-rtp-recv.c @@ -168,8 +168,17 @@ out: return res; } +static const char* const valid_args[] = { + "sink", + "sap_address", + "latency_msec", + "stream_properties", + NULL +}; + DEFINE_MODULE_INFO(module_rtp_recv) = { .name = "module-rtp-recv", + .valid_args = valid_args, .prepare = module_rtp_recv_prepare, .load = module_rtp_recv_load, .unload = module_rtp_recv_unload, diff --git a/src/modules/module-protocol-pulse/modules/module-rtp-send.c b/src/modules/module-protocol-pulse/modules/module-rtp-send.c index 3a6d1d6c6..7d7c2c9cb 100644 --- a/src/modules/module-protocol-pulse/modules/module-rtp-send.c +++ b/src/modules/module-protocol-pulse/modules/module-rtp-send.c @@ -266,8 +266,27 @@ out: return res; } +static const char* const valid_args[] = { + "source", + "format", + "channels", + "rate", + "destination_ip", + "source_ip", + "port", + "mtu", + "loop", + "ttl", + "inhibit_auto_suspend", + "stream_name", + "stream_properties", + "enable_opus", + NULL +}; + DEFINE_MODULE_INFO(module_rtp_send) = { .name = "module-rtp-send", + .valid_args = valid_args, .prepare = module_rtp_send_prepare, .load = module_rtp_send_load, .unload = module_rtp_send_unload, diff --git a/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c b/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c index 89e0f366a..d17866f8e 100644 --- a/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c +++ b/src/modules/module-protocol-pulse/modules/module-zeroconf-publish.c @@ -72,6 +72,8 @@ struct module_zeroconf_publish_data { struct pw_zeroconf *zeroconf; struct spa_hook zeroconf_listener; + unsigned int impl_listening:1; + /* lists of services */ struct spa_list pending; struct spa_list published; @@ -299,6 +301,11 @@ static struct service *create_service(struct module_zeroconf_publish_data *d, st fill_service_data(d, s, o); + if (s->props == NULL) { + spa_list_remove(&s->link); + return NULL; + } + pw_log_debug("service %p: created for object %p", s, o); return s; @@ -475,6 +482,7 @@ static int module_zeroconf_publish_load(struct module *module) &zeroconf_events, data); impl_add_listener(module->impl, &data->impl_listener, &impl_events, data); + data->impl_listening = true; return 0; } @@ -484,7 +492,10 @@ static int module_zeroconf_publish_unload(struct module *module) struct module_zeroconf_publish_data *d = module->user_data; struct service *s; - spa_hook_remove(&d->impl_listener); + if (d->impl_listening) { + spa_hook_remove(&d->impl_listener); + d->impl_listening = false; + } unpublish_all_services(d);