]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: fix two failure paths
authorLennart Poettering <lennart@poettering.net>
Fri, 3 Nov 2023 08:42:53 +0000 (09:42 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 3 Nov 2023 13:39:46 +0000 (14:39 +0100)
We need to go to "finish" rather than just return.

All our exit paths got this right, except two.

src/nspawn/nspawn.c

index 51791d9729856e1015dc29bb216d7cb70c143756..8707c2ff31f02c725336211585dd7c512f243157 100644 (file)
@@ -5659,8 +5659,10 @@ static int run(int argc, char *argv[]) {
 
                         if (arg_pivot_root_new) {
                                 b = path_join(arg_directory, arg_pivot_root_new);
-                                if (!b)
-                                        return log_oom();
+                                if (!b) {
+                                        r = log_oom();
+                                        goto finish;
+                                }
 
                                 p = b;
                         } else
@@ -5678,8 +5680,10 @@ static int run(int argc, char *argv[]) {
                                 p = path_join(arg_directory, arg_pivot_root_new, "/usr/");
                         else
                                 p = path_join(arg_directory, "/usr/");
-                        if (!p)
-                                return log_oom();
+                        if (!p) {
+                                r = log_oom();
+                                goto finish;
+                        }
 
                         if (laccess(p, F_OK) < 0) {
                                 r = log_error_errno(SYNTHETIC_ERRNO(EINVAL),