mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pipewire: allow NULL pointers in pw_properties_free()
Just like the real free() we should just ignore a NULL pointer, makes the caller code easier for those instances where properties are optional. Patch generated with concinelle with a few manual fixes.
This commit is contained in:
parent
a1e821c259
commit
e0471c6757
68 changed files with 142 additions and 273 deletions
|
|
@ -341,10 +341,8 @@ unref:
|
|||
if (!obj->discarded)
|
||||
return 0;
|
||||
|
||||
if (obj->props) {
|
||||
pw_properties_free(obj->props);
|
||||
obj->props = NULL;
|
||||
}
|
||||
pw_properties_free(obj->props);
|
||||
obj->props = NULL;
|
||||
|
||||
spa_list_consume(d, &obj->data, link) {
|
||||
spa_list_remove(&d->link);
|
||||
|
|
@ -818,8 +816,7 @@ static void session_event_info(void *object, const struct pw_session_info *info)
|
|||
if (info) {
|
||||
i->change_mask = info->change_mask;
|
||||
if (info->change_mask & PW_SESSION_CHANGE_MASK_PROPS) {
|
||||
if (i->props)
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
i->props = (struct spa_dict *) pw_properties_new_dict (info->props);
|
||||
}
|
||||
}
|
||||
|
|
@ -857,8 +854,7 @@ static void session_destroy(void *object)
|
|||
spa_list_remove(&endpoint->link);
|
||||
}
|
||||
if (i) {
|
||||
if (i->props)
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
free(i);
|
||||
}
|
||||
|
||||
|
|
@ -898,8 +894,7 @@ static void endpoint_event_info(void *object, const struct pw_endpoint_info *inf
|
|||
i->session_id = info->session_id;
|
||||
}
|
||||
if (info->change_mask & PW_ENDPOINT_CHANGE_MASK_PROPS) {
|
||||
if (i->props)
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
i->props = (struct spa_dict *) pw_properties_new_dict (info->props);
|
||||
if ((str = spa_dict_lookup(i->props, PW_KEY_PRIORITY_SESSION)) != NULL)
|
||||
endpoint->priority = pw_properties_parse_int(str);
|
||||
|
|
@ -954,8 +949,7 @@ static void endpoint_destroy(void *object)
|
|||
spa_list_remove(&endpoint->link);
|
||||
}
|
||||
if (i) {
|
||||
if (i->props)
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
pw_properties_free ((struct pw_properties *)i->props);
|
||||
free(i->name);
|
||||
free(i->media_class);
|
||||
free(i);
|
||||
|
|
@ -1321,8 +1315,7 @@ static void registry_event_free(struct registry_event *re)
|
|||
{
|
||||
if (re->proxy)
|
||||
pw_proxy_destroy(re->proxy);
|
||||
if (re->props_store)
|
||||
pw_properties_free(re->props_store);
|
||||
pw_properties_free(re->props_store);
|
||||
if (re->allocated) {
|
||||
spa_list_remove(&re->link);
|
||||
free(re);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue