From 34680637e838415204850f77c93ca6ca219abaf1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 6 Jan 2023 12:30:36 +0100 Subject: [PATCH] nspawn: guard acl_free() with a NULL check 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nspawn/nspawn-patch-uid.c b/src/nspawn/nspawn-patch-uid.c index 9f369315810..21a17073127 100644 --- a/src/nspawn/nspawn-patch-uid.c +++ b/src/nspawn/nspawn-patch-uid.c @@ -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; -- 2.47.3