mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 16:21:26 +03:00
shared/exec-util: fix minor memleak
p was not freed on error.
This commit is contained in:
parent
73c8cc7164
commit
b230baaeb7
@ -278,18 +278,12 @@ static int gather_environment_generate(int fd, void *arg) {
|
||||
return r;
|
||||
|
||||
STRV_FOREACH_PAIR(x, y, new) {
|
||||
char *p;
|
||||
|
||||
if (!env_name_is_valid(*x)) {
|
||||
log_warning("Invalid variable assignment \"%s=...\", ignoring.", *x);
|
||||
continue;
|
||||
}
|
||||
|
||||
p = strjoin(*x, "=", *y);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
r = strv_env_replace(env, p);
|
||||
r = strv_env_assign(env, *x, *y);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@ -297,7 +291,7 @@ static int gather_environment_generate(int fd, void *arg) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gather_environment_collect(int fd, void *arg) {
|
||||
|
Loading…
Reference in New Issue
Block a user