core: handle NULL props and cleanups

This commit is contained in:
Wim Taymans 2017-06-12 19:47:52 +02:00
parent 611ce2151e
commit 1e71b24952

View file

@ -152,18 +152,17 @@ core_create_node(void *object,
struct pw_client *client = resource->client; struct pw_client *client = resource->client;
struct pw_node_factory *factory; struct pw_node_factory *factory;
struct pw_properties *properties; struct pw_properties *properties;
int i;
factory = pw_core_find_node_factory(client->core, factory_name); factory = pw_core_find_node_factory(client->core, factory_name);
if (factory == NULL) if (factory == NULL)
goto no_factory; goto no_factory;
properties = pw_properties_new(NULL, NULL); if (props) {
properties = pw_properties_new_dict(props);
if (properties == NULL) if (properties == NULL)
goto no_mem; goto no_mem;
} else
for (i = 0; i < props->n_items; i++) properties = NULL;
pw_properties_set(properties, props->items[i].key, props->items[i].value);
/* error will be posted */ /* error will be posted */
pw_node_factory_create_node(factory, client, name, properties, new_id); pw_node_factory_create_node(factory, client, name, properties, new_id);