aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/posix1e
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2015-03-13 18:42:43 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2015-03-13 18:42:43 +0000
commitcf0f0b800cdfdbee72a766640f42bd0aac79983a (patch)
treee903166f526a5adb486bdf1d75c203b95f4f453e /lib/libc/posix1e
parent5f6b63de7a0aca6cca6b2bf164f0e819089564f3 (diff)
Notes
Diffstat (limited to 'lib/libc/posix1e')
-rw-r--r--lib/libc/posix1e/acl_calc_mask.c1
-rw-r--r--lib/libc/posix1e/acl_strip.c14
2 files changed, 11 insertions, 4 deletions
diff --git a/lib/libc/posix1e/acl_calc_mask.c b/lib/libc/posix1e/acl_calc_mask.c
index a2d15276bf3e0..56215b9094c66 100644
--- a/lib/libc/posix1e/acl_calc_mask.c
+++ b/lib/libc/posix1e/acl_calc_mask.c
@@ -104,6 +104,7 @@ acl_calc_mask(acl_t *acl_p)
/* if no mask exists, check acl_cnt... */
if (acl_int_new->acl_cnt == ACL_MAX_ENTRIES) {
errno = ENOMEM;
+ acl_free(acl_new);
return (-1);
}
/* ...and add the mask entry */
diff --git a/lib/libc/posix1e/acl_strip.c b/lib/libc/posix1e/acl_strip.c
index ae37b38a137aa..85dfb4721a3c2 100644
--- a/lib/libc/posix1e/acl_strip.c
+++ b/lib/libc/posix1e/acl_strip.c
@@ -82,8 +82,10 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask)
have_mask_entry = 0;
acl_new = acl_init(ACL_MAX_ENTRIES);
- if (acl_new == NULL)
+ if (acl_new == NULL) {
+ acl_free(acl_old);
return (NULL);
+ }
tag = ACL_UNDEFINED_TAG;
/* only save the default user/group/other entries */
@@ -94,16 +96,16 @@ _posix1e_acl_strip_np(const acl_t aclp, int recalculate_mask)
assert(_entry_brand(entry) == ACL_BRAND_POSIX);
if (acl_get_tag_type(entry, &tag) == -1)
- return (NULL);
+ goto fail;
switch(tag) {
case ACL_USER_OBJ:
case ACL_GROUP_OBJ:
case ACL_OTHER:
if (acl_get_tag_type(entry, &tag) == -1)
- return (NULL);
+ goto fail;
if (acl_get_permset(entry, &perm) == -1)
- return (NULL);
+ goto fail;
if (acl_create_entry(&acl_new, &entry_new) == -1)
return (NULL);
if (acl_set_tag_type(entry_new, tag) == -1)
@@ -120,6 +122,10 @@ _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);