mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-13 13:30:05 -05:00
impl-module: don't leak filename
When dlopen fails, don't leak the filename. Fix indentation.
This commit is contained in:
parent
947ee152d3
commit
6d492db948
1 changed files with 9 additions and 6 deletions
|
|
@ -184,15 +184,18 @@ pw_context_load_module(struct pw_context *context,
|
||||||
while ((p = pw_split_walk(module_dir, ":", &len, &state))) {
|
while ((p = pw_split_walk(module_dir, ":", &len, &state))) {
|
||||||
if ((res = spa_scnprintf(path_part, sizeof(path_part), "%.*s", (int)len, p)) > 0) {
|
if ((res = spa_scnprintf(path_part, sizeof(path_part), "%.*s", (int)len, p)) > 0) {
|
||||||
filename = find_module(path_part, name, 8);
|
filename = find_module(path_part, name, 8);
|
||||||
if (filename != NULL) {
|
if (filename != NULL) {
|
||||||
pw_log_debug("trying to load module: %s (%s) args(%s)", name, filename, args);
|
pw_log_debug("trying to load module: %s (%s) args(%s)", name, filename, args);
|
||||||
|
|
||||||
hnd = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
|
hnd = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
|
||||||
if (hnd != NULL)
|
if (hnd != NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
free(filename);
|
||||||
|
filename = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
goto error_not_found;
|
goto error_not_found;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue