mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
spa: alsa: fix leaks in get_data_path()
Coverity rightfully complains that assigning to `path` will lose its previous value leading to resource leaks.
This commit is contained in:
parent
7465175ad0
commit
e0bfdb9f46
1 changed files with 3 additions and 4 deletions
|
|
@ -251,7 +251,6 @@ char *get_data_path(const char *data_dir, const char *data_type, const char *fna
|
|||
};
|
||||
const char *e;
|
||||
spa_autofree char *base = NULL;
|
||||
spa_autofree char *path = NULL;
|
||||
char *result;
|
||||
|
||||
if (data_dir)
|
||||
|
|
@ -271,18 +270,18 @@ char *get_data_path(const char *data_dir, const char *data_type, const char *fna
|
|||
base = get_xdg_home("XDG_CONFIG_HOME", ".config");
|
||||
if (base) {
|
||||
SPA_FOR_EACH_ELEMENT_VAR(subpaths, subpath) {
|
||||
path = spa_aprintf("%s/%s/%s", base, *subpath, data_type);
|
||||
spa_autofree char *path = spa_aprintf("%s/%s/%s", base, *subpath, data_type);
|
||||
if ((result = try_path(fname, path)) != NULL)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
SPA_FOR_EACH_ELEMENT_VAR(subpaths, subpath) {
|
||||
path = spa_aprintf("/etc/%s/%s", *subpath, data_type);
|
||||
spa_autofree char *path = spa_aprintf("/etc/%s/%s", *subpath, data_type);
|
||||
if ((result = try_path(fname, path)) != NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
path = spa_aprintf("%s/%s", PA_ALSA_DATA_DIR, data_type);
|
||||
spa_autofree char *path = spa_aprintf("%s/%s", PA_ALSA_DATA_DIR, data_type);
|
||||
return pa_maybe_prefix_path(fname, path);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue