From a940e75467931de75e969b3de97f21698ec6fa08 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 2 Mar 2018 08:52:19 -0500 Subject: [PATCH] src/libadacl.c: remove two NULL checks around acl_free() calls. The acl_free() function will return ACL_ERROR and set errno to EINVAL if we pass it a null pointer; but aside from that, nothing bad happens, and removing the checks makes the code marginally cleaner. --- src/libadacl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libadacl.c b/src/libadacl.c index 5eec144..b8f6099 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -906,12 +906,9 @@ int apply_default_acl_ex(const char* path, cleanup: free(dirname_path_copy); free(basename_path_copy); - if (new_acl != (acl_t)NULL) { - acl_free(new_acl); - } - if (new_acl_unmasked != (acl_t)NULL) { - acl_free(new_acl_unmasked); - } + acl_free(new_acl); + acl_free(new_acl_unmasked); + if (fd > 0 && close(fd) == CLOSE_ERROR) { perror("apply_default_acl_ex (close fd)"); result = ACL_ERROR; -- 2.44.2