mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pipewire: allow NULL pointers in pw_free_strv()
Just like the real free() we should just ignore a NULL pointer, makes the caller code easier for those instances where properties are optional.
This commit is contained in:
parent
e0471c6757
commit
71e0cfb5fa
5 changed files with 10 additions and 12 deletions
|
|
@ -384,8 +384,7 @@ static int module_combine_sink_unload(struct client *client, struct module *modu
|
|||
pw_manager_destroy(d->manager);
|
||||
if (d->core != NULL)
|
||||
pw_core_disconnect(d->core);
|
||||
if (d->sink_names)
|
||||
pw_free_strv(d->sink_names);
|
||||
pw_free_strv(d->sink_names);
|
||||
free(d->sink_name);
|
||||
|
||||
return 0;
|
||||
|
|
@ -462,8 +461,7 @@ struct module *create_module_combine_sink(struct impl *impl, const char *argumen
|
|||
return module;
|
||||
out:
|
||||
pw_properties_free(props);
|
||||
if (sink_names)
|
||||
pw_free_strv(sink_names);
|
||||
pw_free_strv(sink_names);
|
||||
errno = -res;
|
||||
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ error_arguments:
|
|||
pw_log_error("usage: module-spa-device " MODULE_USAGE);
|
||||
goto error_exit_cleanup;
|
||||
error_exit_cleanup:
|
||||
if (argv)
|
||||
pw_free_strv(argv);
|
||||
pw_free_strv(argv);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ error_arguments:
|
|||
pw_log_error("usage: module-spa-node " MODULE_USAGE);
|
||||
goto error_exit_cleanup;
|
||||
error_exit_cleanup:
|
||||
if (argv)
|
||||
pw_free_strv(argv);
|
||||
pw_free_strv(argv);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,8 +221,7 @@ static void configure_debug(struct support *support, const char *str)
|
|||
if (n_tokens > 1)
|
||||
support->categories = pw_split_strv(level[1], ",", INT_MAX, &n_tokens);
|
||||
|
||||
if (level)
|
||||
pw_free_strv(level);
|
||||
pw_free_strv(level);
|
||||
}
|
||||
|
||||
SPA_EXPORT
|
||||
|
|
@ -564,8 +563,7 @@ void pw_deinit(void)
|
|||
unref_handle(h);
|
||||
unref_plugin(p);
|
||||
}
|
||||
if (support->categories)
|
||||
pw_free_strv(support->categories);
|
||||
pw_free_strv(support->categories);
|
||||
free(support->i18n_domain);
|
||||
spa_zero(global_support);
|
||||
spa_zero(global_registry);
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ SPA_EXPORT
|
|||
void pw_free_strv(char **str)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (str == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; str[i]; i++)
|
||||
free(str[i]);
|
||||
free(str);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue