fix some leaks

This commit is contained in:
Wim Taymans 2018-09-24 09:33:09 +02:00
parent 132ee30930
commit 30316df5c8
3 changed files with 14 additions and 5 deletions

View file

@ -161,6 +161,9 @@ static void *create_object(void *_data,
pw_node_set_active(dsp, true); pw_node_set_active(dsp, true);
if (properties)
pw_properties_free(properties);
return dsp; return dsp;
no_resource: no_resource:

View file

@ -140,6 +140,8 @@ struct node {
struct port *in_ports[MAX_INPUTS]; struct port *in_ports[MAX_INPUTS];
struct port *out_ports[MAX_OUTPUTS]; struct port *out_ports[MAX_OUTPUTS];
struct port dummy;
uint32_t n_params; uint32_t n_params;
struct spa_pod **params; struct spa_pod **params;
@ -1046,10 +1048,12 @@ client_node_port_update(void *data,
clear_port(this, port); clear_port(this, port);
pw_node_update_ports(impl->this.node); pw_node_update_ports(impl->this.node);
} else { } else {
struct port dummy = { 0 }, *target; struct port *target;
if (port == NULL) if (port == NULL) {
target = &dummy; target = &this->dummy;
spa_zero(this->dummy);
}
else else
target = port; target = port;
@ -1061,11 +1065,11 @@ client_node_port_update(void *data,
if (port == NULL) { if (port == NULL) {
if (direction == SPA_DIRECTION_INPUT) { if (direction == SPA_DIRECTION_INPUT) {
this->n_inputs++; this->n_inputs++;
this->in_ports[port_id] = &dummy; this->in_ports[port_id] = target;
} }
else { else {
this->n_outputs++; this->n_outputs++;
this->out_ports[port_id] = &dummy; this->out_ports[port_id] = target;
} }
pw_node_update_ports(impl->this.node); pw_node_update_ports(impl->this.node);
} }

View file

@ -119,11 +119,13 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this,
&props->dict, &props->dict,
support, support,
n_support)) < 0) { n_support)) < 0) {
pw_properties_free(props);
pw_log_error("can't make factory instance: %d", res); pw_log_error("can't make factory instance: %d", res);
return NULL; return NULL;
} }
if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Node, &node_iface)) < 0) { if ((res = spa_handle_get_interface(handle, SPA_TYPE_INTERFACE_Node, &node_iface)) < 0) {
pw_log_error("can't get NODE interface: %d", res); pw_log_error("can't get NODE interface: %d", res);
pw_properties_free(props);
return NULL; return NULL;
} }