summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/sysacls.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index b0ba2075ab..778f467c12 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -302,18 +302,19 @@ SMB_ACL_T sys_acl_get_file(const char *path_p, SMB_ACL_TYPE_T type)
while ((count = acl(path_p, GETACL, count, &acl_d->acl[0])) < 0
&& errno == ENOSPC) {
+ sys_acl_free_acl(acl_d);
+
if ((count = acl(path_p, GETACLCNT, 0, NULL)) < 0) {
return NULL;
}
- sys_acl_free_acl(acl_d);
-
if ((acl_d = sys_acl_init(count)) == NULL) {
return NULL;
}
}
if (count < 0) {
+ sys_acl_free_acl(acl_d);
return NULL;
}
@@ -365,18 +366,19 @@ SMB_ACL_T sys_acl_get_fd(int fd)
while ((count = facl(fd, GETACL, count, &acl_d->acl[0])) < 0
&& errno == ENOSPC) {
+ sys_acl_free_acl(acl_d);
+
if ((count = facl(fd, GETACLCNT, 0, NULL)) < 0) {
return NULL;
}
- sys_acl_free_acl(acl_d);
-
if ((acl_d = sys_acl_init(count)) == NULL) {
return NULL;
}
}
if (count < 0) {
+ sys_acl_free_acl(acl_d);
return NULL;
}