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:
Peter Hutterer 2021-06-01 11:21:17 +10:00 committed by Wim Taymans
parent a1e821c259
commit e0471c6757
68 changed files with 142 additions and 273 deletions

View file

@ -120,8 +120,7 @@ static int client_endpoint_stream_update(void *object,
: 0;
no_mem:
if (props)
pw_properties_free(props);
pw_properties_free(props);
free(stream);
pw_log_error(NAME" %p: cannot update stream: no memory", this);
pw_resource_errorf(this->resource, -ENOMEM,
@ -204,8 +203,7 @@ static void *create_object(void *data,
return this;
no_mem:
if (properties)
pw_properties_free(properties);
pw_properties_free(properties);
if (this && this->resource)
pw_resource_destroy(this->resource);
free(this);

View file

@ -333,6 +333,5 @@ void endpoint_stream_clear(struct endpoint_stream *this)
free(this->info.link_params);
free(this->info.params);
if (this->props)
pw_properties_free(this->props);
pw_properties_free(this->props);
}

View file

@ -365,6 +365,5 @@ void endpoint_clear(struct endpoint *this)
free(this->info.media_class);
free(this->info.params);
if (this->props)
pw_properties_free(this->props);
pw_properties_free(this->props);
}

View file

@ -119,8 +119,7 @@ static int client_session_link_update(void *object,
: 0;
no_mem:
if (props)
pw_properties_free(props);
pw_properties_free(props);
free(link);
pw_log_error(NAME" %p: cannot update link: no memory", this);
pw_resource_error(this->resource, -ENOMEM,
@ -203,8 +202,7 @@ static void *create_object(void *data,
return this;
no_mem:
if (properties)
pw_properties_free(properties);
pw_properties_free(properties);
if (this && this->resource)
pw_resource_destroy(this->resource);
free(this);

View file

@ -350,6 +350,5 @@ void endpoint_link_clear(struct endpoint_link *this)
free(this->info.error);
free(this->info.params);
if (this->props)
pw_properties_free(this->props);
pw_properties_free(this->props);
}

View file

@ -325,6 +325,5 @@ void session_clear(struct session *this)
free(this->info.params);
if (this->props)
pw_properties_free(this->props);
pw_properties_free(this->props);
}