From 8e6acc531a584b0e2d3d1fc5ec9b481391cd0fe8 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Thu, 3 Sep 2015 11:31:34 +0000 Subject: [PATCH] Fix acl_strip_np(3) breakage introduced in r279962. MFC after: 1 month Sponsored by: The FreeBSD Foundation --- lib/libc/posix1e/acl_strip.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/libc/posix1e/acl_strip.c b/lib/libc/posix1e/acl_strip.c index 85dfb4721a3..24fda848064 100644 --- a/lib/libc/posix1e/acl_strip.c +++ b/lib/libc/posix1e/acl_strip.c @@ -107,13 +107,13 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask) if (acl_get_permset(entry, &perm) == -1) goto fail; if (acl_create_entry(&acl_new, &entry_new) == -1) - return (NULL); + goto fail; if (acl_set_tag_type(entry_new, tag) == -1) - return (NULL); + goto fail; if (acl_set_permset(entry_new, perm) == -1) - return (NULL); + goto fail; if (acl_copy_entry(entry_new, entry) == -1) - return (NULL); + goto fail; assert(_entry_brand(entry_new) == ACL_BRAND_POSIX); break; case ACL_MASK: @@ -122,20 +122,22 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask) default: break; } -fail: - acl_free(acl_new); - acl_free(acl_old); - return (NULL); } assert(_acl_brand(acl_new) == ACL_BRAND_POSIX); if (have_mask_entry && recalculate_mask) { if (acl_calc_mask(&acl_new) == -1) - return (NULL); + goto fail; } return (acl_new); + +fail: + acl_free(acl_new); + acl_free(acl_old); + + return (NULL); } acl_t