From: Michael Orlitzky Date: Fri, 2 Mar 2018 13:52:19 +0000 (-0500) Subject: src/libadacl.c: remove two NULL checks around acl_free() calls. X-Git-Tag: v0.2.0~2 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=apply-default-acl.git;a=commitdiff_plain;h=a940e75467931de75e969b3de97f21698ec6fa08 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. --- 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;