manager: fix memleak on repeated systemd.setenv keys
This commit is contained in:
+6
-9
@@ -452,16 +452,13 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||
if (proc_cmdline_value_missing(key, value))
|
||||
return 0;
|
||||
|
||||
if (env_assignment_is_valid(value)) {
|
||||
char **env;
|
||||
|
||||
env = strv_env_set(arg_default_environment, value);
|
||||
if (!env)
|
||||
if (!env_assignment_is_valid(value))
|
||||
log_warning("Environment variable assignment '%s' is not valid. Ignoring.", value);
|
||||
else {
|
||||
r = strv_env_replace_strdup(&arg_default_environment, value);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
arg_default_environment = env;
|
||||
} else
|
||||
log_warning("Environment variable name '%s' is not valid. Ignoring.", value);
|
||||
}
|
||||
|
||||
} else if (proc_cmdline_key_streq(key, "systemd.machine_id")) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user