mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -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
|
|
@ -400,8 +400,7 @@ struct format_info {
|
|||
|
||||
static void format_info_clear(struct format_info *info)
|
||||
{
|
||||
if (info->props)
|
||||
pw_properties_free(info->props);
|
||||
pw_properties_free(info->props);
|
||||
spa_zero(*info);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -194,8 +194,7 @@ static void object_destroy(struct object *o)
|
|||
m->this.n_objects--;
|
||||
if (o->this.proxy)
|
||||
pw_proxy_destroy(o->this.proxy);
|
||||
if (o->this.props)
|
||||
pw_properties_free(o->this.props);
|
||||
pw_properties_free(o->this.props);
|
||||
if (o->this.message_object_path)
|
||||
free(o->this.message_object_path);
|
||||
clear_params(&o->this.param_list, SPA_ID_INVALID);
|
||||
|
|
|
|||
|
|
@ -83,8 +83,7 @@ static void module_free(struct module *module)
|
|||
pw_work_queue_cancel(impl->work_queue, module, SPA_ID_INVALID);
|
||||
free((char*)module->name);
|
||||
free((char*)module->args);
|
||||
if (module->props)
|
||||
pw_properties_free(module->props);
|
||||
pw_properties_free(module->props);
|
||||
free(module);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -461,8 +461,7 @@ struct module *create_module_combine_sink(struct impl *impl, const char *argumen
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
if (sink_names)
|
||||
pw_free_strv(sink_names);
|
||||
errno = -res;
|
||||
|
|
|
|||
|
|
@ -233,12 +233,9 @@ struct module *create_module_ladspa_sink(struct impl *impl, const char *argument
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (playback_props)
|
||||
pw_properties_free(playback_props);
|
||||
if (capture_props)
|
||||
pw_properties_free(capture_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(playback_props);
|
||||
pw_properties_free(capture_props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,12 +233,9 @@ struct module *create_module_ladspa_source(struct impl *impl, const char *argume
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (playback_props)
|
||||
pw_properties_free(playback_props);
|
||||
if (capture_props)
|
||||
pw_properties_free(capture_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(playback_props);
|
||||
pw_properties_free(capture_props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,12 +236,9 @@ struct module *create_module_loopback(struct impl *impl, const char *argument)
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (playback_props)
|
||||
pw_properties_free(playback_props);
|
||||
if (capture_props)
|
||||
pw_properties_free(capture_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(playback_props);
|
||||
pw_properties_free(capture_props);
|
||||
errno = -res;
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -127,8 +127,7 @@ struct module *create_module_native_protocol_tcp(struct impl *impl, const char *
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,8 +203,7 @@ struct module *create_module_null_sink(struct impl *impl, const char *argument)
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,8 +189,7 @@ static int module_pipesink_unload(struct client *client, struct module *module)
|
|||
|
||||
pw_log_info("unload module %p id:%u name:%s", module, module->idx, module->name);
|
||||
|
||||
if (d->capture_props != NULL)
|
||||
pw_properties_free(d->capture_props);
|
||||
pw_properties_free(d->capture_props);
|
||||
if (d->capture != NULL)
|
||||
pw_stream_destroy(d->capture);
|
||||
if (d->core != NULL)
|
||||
|
|
@ -321,10 +320,8 @@ struct module *create_module_pipe_sink(struct impl *impl, const char *argument)
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (capture_props)
|
||||
pw_properties_free(capture_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(capture_props);
|
||||
if (filename) {
|
||||
if (do_unlink_fifo)
|
||||
unlink(filename);
|
||||
|
|
|
|||
|
|
@ -229,12 +229,9 @@ struct module *create_module_remap_sink(struct impl *impl, const char *argument)
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (playback_props)
|
||||
pw_properties_free(playback_props);
|
||||
if (capture_props)
|
||||
pw_properties_free(capture_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(playback_props);
|
||||
pw_properties_free(capture_props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,12 +229,9 @@ struct module *create_module_remap_source(struct impl *impl, const char *argumen
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (playback_props)
|
||||
pw_properties_free(playback_props);
|
||||
if (capture_props)
|
||||
pw_properties_free(capture_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(playback_props);
|
||||
pw_properties_free(capture_props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,10 +187,8 @@ struct module *create_module_simple_protocol_tcp(struct impl *impl, const char *
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (module_props)
|
||||
pw_properties_free(module_props);
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(module_props);
|
||||
pw_properties_free(props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,10 +214,8 @@ struct module *create_module_tunnel_sink(struct impl *impl, const char *argument
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (stream_props)
|
||||
pw_properties_free(stream_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(stream_props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,10 +214,8 @@ struct module *create_module_tunnel_source(struct impl *impl, const char *argume
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
if (stream_props)
|
||||
pw_properties_free(stream_props);
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(stream_props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,8 +131,7 @@ struct module *create_module_zeroconf_discover(struct impl *impl, const char *ar
|
|||
|
||||
return module;
|
||||
out:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,8 +134,7 @@ static void sample_free(struct sample *sample)
|
|||
|
||||
if (sample->index != SPA_ID_INVALID)
|
||||
pw_map_remove(&impl->samples, sample->index);
|
||||
if (sample->props)
|
||||
pw_properties_free(sample->props);
|
||||
pw_properties_free(sample->props);
|
||||
free(sample->buffer);
|
||||
free(sample);
|
||||
}
|
||||
|
|
@ -968,8 +967,7 @@ static void stream_free(struct stream *stream)
|
|||
|
||||
if (stream->buffer)
|
||||
free(stream->buffer);
|
||||
if (stream->props)
|
||||
pw_properties_free(stream->props);
|
||||
pw_properties_free(stream->props);
|
||||
free(stream);
|
||||
}
|
||||
|
||||
|
|
@ -1982,8 +1980,7 @@ error_invalid:
|
|||
res = -EINVAL;
|
||||
goto error;
|
||||
error:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
if (stream)
|
||||
stream_free(stream);
|
||||
return res;
|
||||
|
|
@ -2234,8 +2231,7 @@ error_invalid:
|
|||
res = -EINVAL;
|
||||
goto error;
|
||||
error:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
if (stream)
|
||||
stream_free(stream);
|
||||
return res;
|
||||
|
|
@ -2453,8 +2449,7 @@ error_toolarge:
|
|||
res = -EOVERFLOW;
|
||||
goto error;
|
||||
error:
|
||||
if (props != NULL)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
if (stream)
|
||||
stream_free(stream);
|
||||
return res;
|
||||
|
|
@ -2500,8 +2495,7 @@ static int do_finish_upload_stream(struct client *client, uint32_t command, uint
|
|||
|
||||
event = SUBSCRIPTION_EVENT_NEW;
|
||||
} else {
|
||||
if (sample->props)
|
||||
pw_properties_free(sample->props);
|
||||
pw_properties_free(sample->props);
|
||||
free(sample->buffer);
|
||||
event = SUBSCRIPTION_EVENT_CHANGE;
|
||||
}
|
||||
|
|
@ -2779,8 +2773,7 @@ error_noent:
|
|||
res = -ENOENT;
|
||||
goto error;
|
||||
error:
|
||||
if (props != NULL)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -3447,8 +3440,7 @@ static int do_update_proplist(struct client *client, uint32_t command, uint32_t
|
|||
}
|
||||
res = reply_simple_ack(client, tag);
|
||||
exit:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
return res;
|
||||
|
||||
error_protocol:
|
||||
|
|
@ -3515,8 +3507,7 @@ static int do_remove_proplist(struct client *client, uint32_t command, uint32_t
|
|||
}
|
||||
res = reply_simple_ack(client, tag);
|
||||
exit:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
return res;
|
||||
|
||||
error_protocol:
|
||||
|
|
@ -6693,8 +6684,7 @@ error_free:
|
|||
free(impl);
|
||||
|
||||
error_exit:
|
||||
if (props != NULL)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
|
||||
if (res < 0)
|
||||
errno = -res;
|
||||
|
|
|
|||
|
|
@ -215,8 +215,7 @@ static struct sample_play *sample_play_new(struct pw_core *core,
|
|||
error_cleanup:
|
||||
pw_stream_destroy(p->stream);
|
||||
error_free:
|
||||
if (props)
|
||||
pw_properties_free(props);
|
||||
pw_properties_free(props);
|
||||
free(p);
|
||||
errno = -res;
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue