From dcfb6aad16b4b7b70a63340a17771d3f40aed1ce Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 12 Aug 2012 20:41:35 +1000 Subject: s3-smbd: Change allocation of smb_acl_t to talloc() The acl element is changed to be a talloc child, and is no longer one element longer than requested by virtue of the acl[1] base pointer. This also avoids one of the few remaining cases of over-allocation of a structure. Andrew Bartlett --- source3/modules/vfs_hpuxacl.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'source3/modules/vfs_hpuxacl.c') diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index 1b5d8d087d..f8661b1134 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -386,7 +386,7 @@ int hpuxacl_sys_acl_delete_def_file(vfs_handle_struct *handle, done: DEBUG(10, ("hpuxacl_sys_acl_delete_def_file %s.\n", ((ret != 0) ? "failed" : "succeeded" ))); - SAFE_FREE(smb_acl); + TALLOC_FREE(smb_acl); return ret; } @@ -506,11 +506,8 @@ static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpux_acl, int count, if (!_IS_OF_TYPE(hpux_acl[i], type)) { continue; } - result = SMB_REALLOC(result, - sizeof(struct smb_acl_t) + - (sizeof(struct smb_acl_entry) * - (result->count + 1))); - if (result == NULL) { + result->acl = talloc_realloc(result, result->acl, struct smb_acl_entry, result->count + 1); + if (result->acl == NULL) { DEBUG(10, ("error reallocating memory for SMB_ACL\n")); goto fail; } @@ -534,7 +531,7 @@ static SMB_ACL_T hpux_acl_to_smb_acl(HPUX_ACL_T hpux_acl, int count, } goto done; fail: - SAFE_FREE(result); + TALLOC_FREE(result); done: DEBUG(10, ("hpux_acl_to_smb_acl %s\n", ((result == NULL) ? "failed" : "succeeded"))); -- cgit