From bebfe0e4982c29e97032c1d40155620d37595e77 Mon Sep 17 00:00:00 2001 From: Ronny Chevalier Date: Sun, 14 May 2017 16:30:40 +0200 Subject: [PATCH] env-util: fix memory leak (#5962) If cunescape succeeds, but the assignment is not valid, uce is not freed. --- src/basic/env-util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/basic/env-util.c b/src/basic/env-util.c index 1b8a96def..cb73c9caa 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -800,8 +800,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); } -- 2.30.2