env-util: fix memory leak (#5962)

If cunescape succeeds, but the assignment is not valid, uce is not freed.
This commit is contained in:
Ronny Chevalier
2017-05-14 10:30:40 -04:00
committed by Zbigniew Jędrzejewski-Szmek
parent 0839f42ebf
commit 16eefcafed
2 changed files with 13 additions and 1 deletions
+3 -1
View File
@@ -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);
}