diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-08-27 13:49:21 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-08-27 18:20:34 +0900 |
commit | 8062e643e62387895ea9c3243aeca7c7a894fcd1 (patch) | |
tree | c84f4bc8d2c590d4f1d7f04c793972d5e2f83d53 /src | |
parent | 67165f76305a5d61bcfa3633defd82f6ee8ecc04 (diff) | |
download | systemd-8062e643e62387895ea9c3243aeca7c7a894fcd1.tar.gz |
core: clear bind mounts on error
Follow-up for bbb4e7f39f2c68c719c26c2c65f8b7b91b009e92.
Fixes CID#1431998.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/execute.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 444c3985f1..1680fc72a2 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -3127,8 +3127,10 @@ static int apply_mount_namespace( if (exec_context_has_credentials(context) && params->prefix[EXEC_DIRECTORY_RUNTIME]) { creds_path = path_join(params->prefix[EXEC_DIRECTORY_RUNTIME], "credentials", u->id); - if (!creds_path) - return -ENOMEM; + if (!creds_path) { + r = -ENOMEM; + goto finalize; + } } r = setup_namespace(root_dir, root_image, context->root_image_options, @@ -3174,6 +3176,7 @@ static int apply_mount_namespace( } } +finalize: bind_mount_free_many(bind_mounts, n_bind_mounts); return r; } |