summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-02-23 15:43:19 +0100
committerLennart Poettering <lennart@poettering.net>2021-02-23 15:45:26 +0100
commitf2550b9856f9b89bc65e19754cb573c0a19ed1a0 (patch)
treec130bace68195505ebac949f327b86264aa92803 /src/core
parentresolved: don't dereference ->scope unless set (diff)
downloadsystemd-f2550b9856f9b89bc65e19754cb573c0a19ed1a0.tar.xz
systemd-f2550b9856f9b89bc65e19754cb573c0a19ed1a0.zip
core: fix memory leak in error path
Coverity 1431998
Diffstat (limited to 'src/core')
-rw-r--r--src/core/execute.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index d27adbbba5..e5c80fb183 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -3202,11 +3202,16 @@ static int apply_mount_namespace(
if (MANAGER_IS_SYSTEM(u->manager)) {
propagate_dir = path_join("/run/systemd/propagate/", u->id);
- if (!propagate_dir)
- return -ENOMEM;
+ if (!propagate_dir) {
+ r = -ENOMEM;
+ goto finalize;
+ }
+
incoming_dir = strdup("/run/systemd/incoming");
- if (!incoming_dir)
- return -ENOMEM;
+ if (!incoming_dir) {
+ r = -ENOMEM;
+ goto finalize;
+ }
}
r = setup_namespace(root_dir, root_image, context->root_image_options,