env-util: fix memory leak (#5962)
If cunescape succeeds, but the assignment is not valid, uce is not freed.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
0839f42ebf
commit
16eefcafed
@@ -799,8 +799,10 @@ int deserialize_environment(char ***environment, const char *line) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!env_assignment_is_valid(uce))
|
||||
if (!env_assignment_is_valid(uce)) {
|
||||
free(uce);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return strv_env_replace(environment, uce);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user