mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
modules: fix some leaks in error paths
As found by coverity
This commit is contained in:
parent
5bed3f1ff3
commit
c50c8d2be9
3 changed files with 21 additions and 19 deletions
|
|
@ -949,17 +949,17 @@ static int parse_link(struct graph *graph, struct spa_json *json)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (in_port->n_links > 0) {
|
||||||
|
pw_log_info("Can't have more than 1 link to %s, use a mixer", input);
|
||||||
|
return -ENOTSUP;
|
||||||
|
}
|
||||||
|
|
||||||
if ((link = calloc(1, sizeof(*link))) == NULL)
|
if ((link = calloc(1, sizeof(*link))) == NULL)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
link->output = out_port;
|
link->output = out_port;
|
||||||
link->input = in_port;
|
link->input = in_port;
|
||||||
|
|
||||||
if (in_port->n_links > 0) {
|
|
||||||
pw_log_info("Can't have more than 1 link to %s, use a mixer", input);
|
|
||||||
return -ENOTSUP;
|
|
||||||
}
|
|
||||||
|
|
||||||
pw_log_info("linking %s:%s -> %s:%s",
|
pw_log_info("linking %s:%s -> %s:%s",
|
||||||
out_port->node->name,
|
out_port->node->name,
|
||||||
out_port->node->desc->desc->PortNames[out_port->p],
|
out_port->node->desc->desc->PortNames[out_port->p],
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,14 @@ static int module_ladspa_sink_load(struct client *client, struct module *module)
|
||||||
struct module_ladspa_sink_data *data = module->user_data;
|
struct module_ladspa_sink_data *data = module->user_data;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *args;
|
char *args;
|
||||||
const char *str;
|
const char *str, *plugin, *label;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
if ((plugin = pw_properties_get(module->props, "plugin")) == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
if ((label = pw_properties_get(module->props, "label")) == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "ladspa-sink-%u", module->idx);
|
pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "ladspa-sink-%u", module->idx);
|
||||||
pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "ladspa-sink-%u", module->idx);
|
pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "ladspa-sink-%u", module->idx);
|
||||||
|
|
||||||
|
|
@ -100,12 +105,8 @@ static int module_ladspa_sink_load(struct client *client, struct module *module)
|
||||||
fprintf(f, " filter.graph = {");
|
fprintf(f, " filter.graph = {");
|
||||||
fprintf(f, " nodes = [ { ");
|
fprintf(f, " nodes = [ { ");
|
||||||
fprintf(f, " type = ladspa ");
|
fprintf(f, " type = ladspa ");
|
||||||
if ((str = pw_properties_get(module->props, "plugin")) == NULL)
|
fprintf(f, " plugin = \"%s\" ", plugin);
|
||||||
return -EINVAL;
|
fprintf(f, " label = \"%s\" ", label);
|
||||||
fprintf(f, " plugin = \"%s\" ", str);
|
|
||||||
if ((str = pw_properties_get(module->props, "label")) == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
fprintf(f, " label = \"%s\" ", str);
|
|
||||||
if ((str = pw_properties_get(module->props, "inputs")) != NULL)
|
if ((str = pw_properties_get(module->props, "inputs")) != NULL)
|
||||||
fprintf(f, " inputs = [ %s ] ", str);
|
fprintf(f, " inputs = [ %s ] ", str);
|
||||||
if ((str = pw_properties_get(module->props, "outputs")) != NULL)
|
if ((str = pw_properties_get(module->props, "outputs")) != NULL)
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,14 @@ static int module_ladspa_source_load(struct client *client, struct module *modul
|
||||||
struct module_ladspa_source_data *data = module->user_data;
|
struct module_ladspa_source_data *data = module->user_data;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *args;
|
char *args;
|
||||||
const char *str;
|
const char *str, *plugin, *label;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
if ((plugin = pw_properties_get(module->props, "plugin")) == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
if ((label = pw_properties_get(module->props, "label")) == NULL)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "ladspa-source-%u", module->idx);
|
pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "ladspa-source-%u", module->idx);
|
||||||
pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "ladspa-source-%u", module->idx);
|
pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "ladspa-source-%u", module->idx);
|
||||||
|
|
||||||
|
|
@ -100,12 +105,8 @@ static int module_ladspa_source_load(struct client *client, struct module *modul
|
||||||
fprintf(f, " filter.graph = {");
|
fprintf(f, " filter.graph = {");
|
||||||
fprintf(f, " nodes = [ { ");
|
fprintf(f, " nodes = [ { ");
|
||||||
fprintf(f, " type = ladspa ");
|
fprintf(f, " type = ladspa ");
|
||||||
if ((str = pw_properties_get(module->props, "plugin")) == NULL)
|
fprintf(f, " plugin = \"%s\" ", plugin);
|
||||||
return -EINVAL;
|
fprintf(f, " label = \"%s\" ", label);
|
||||||
fprintf(f, " plugin = \"%s\" ", str);
|
|
||||||
if ((str = pw_properties_get(module->props, "label")) == NULL)
|
|
||||||
return -EINVAL;
|
|
||||||
fprintf(f, " label = \"%s\" ", str);
|
|
||||||
if ((str = pw_properties_get(module->props, "inputs")) != NULL)
|
if ((str = pw_properties_get(module->props, "inputs")) != NULL)
|
||||||
fprintf(f, " inputs = [ %s ] ", str);
|
fprintf(f, " inputs = [ %s ] ", str);
|
||||||
if ((str = pw_properties_get(module->props, "outputs")) != NULL)
|
if ((str = pw_properties_get(module->props, "outputs")) != NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue