diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/sysacls.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c index 592aef6d43..7e387e444b 100644 --- a/source3/lib/sysacls.c +++ b/source3/lib/sysacls.c @@ -258,15 +258,7 @@ SMB_ACL_T sys_acl_init(int count) return NULL; } - /* - * note that since the definition of the structure pointed - * to by the SMB_ACL_T includes the first element of the - * acl[] array, this actually allocates an ACL with room - * for (count+1) entries - */ - if ((a = (struct smb_acl_t *)SMB_MALLOC( - sizeof(struct smb_acl_t) + - count * sizeof(struct smb_acl_entry))) == NULL) { + if ((a = talloc(NULL, struct smb_acl_t)) == NULL) { errno = ENOMEM; return NULL; } @@ -275,6 +267,13 @@ SMB_ACL_T sys_acl_init(int count) a->count = 0; a->next = -1; + a->acl = talloc_array(a, struct smb_acl_entry, count+1); + if (!a->acl) { + TALLOC_FREE(a); + errno = ENOMEM; + return NULL; + } + return a; } @@ -357,7 +356,7 @@ int sys_acl_free_text(char *text) int sys_acl_free_acl(SMB_ACL_T acl_d) { - SAFE_FREE(acl_d); + TALLOC_FREE(acl_d); return 0; } |