]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: guard acl_free() with a NULL check
authorLennart Poettering <lennart@poettering.net>
Fri, 6 Jan 2023 11:30:36 +0000 (12:30 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 6 Jan 2023 13:59:09 +0000 (14:59 +0100)
Inspired by #25957 there's one other place where we don't guard
acl_free() calls with a NULL check.

Fix that.

src/nspawn/nspawn-patch-uid.c

index 9f369315810590028b17cc7cfd2dd2c49b53825e..21a170731279d8f5ba0807a3d1d56632f1bbcf5b 100644 (file)
@@ -181,7 +181,9 @@ static int patch_acls(int fd, const char *name, const struct stat *st, uid_t shi
 
         if (S_ISDIR(st->st_mode)) {
                 acl_free(acl);
-                acl_free(shifted);
+
+                if (shifted)
+                        acl_free(shifted);
 
                 acl = shifted = NULL;