mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 16:21:26 +03:00
sd-login: fix memleak when output argument is NULL
This commit is contained in:
parent
c1db1a8058
commit
964806347b
@ -878,7 +878,8 @@ _public_ int sd_get_uids(uid_t **users) {
|
||||
}
|
||||
|
||||
_public_ int sd_get_machine_names(char ***machines) {
|
||||
char **l, **a, **b;
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
char **a, **b;
|
||||
int r;
|
||||
|
||||
r = get_files_in_directory("/run/systemd/machines/", &l);
|
||||
@ -907,8 +908,10 @@ _public_ int sd_get_machine_names(char ***machines) {
|
||||
*b = NULL;
|
||||
}
|
||||
|
||||
if (machines)
|
||||
if (machines) {
|
||||
*machines = l;
|
||||
l = NULL;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user