summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-30 02:39:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:49 -0500
commitbe8b0685a55700c6bce3681734800ec6434b0364 (patch)
tree8616d85686fb147d431eeea435233f45d5ee8d41 /source3/lib
parent79de0ad9463a5cd64978beae37df79fbb4f74632 (diff)
downloadsamba-be8b0685a55700c6bce3681734800ec6434b0364.tar.gz
samba-be8b0685a55700c6bce3681734800ec6434b0364.tar.bz2
samba-be8b0685a55700c6bce3681734800ec6434b0364.zip
r22589: Make TALLOC_ARRAY consistent across all uses.
Jeremy. (This used to be commit 8968808c3b5b0208cbad9ac92eaf948f2c546dd9)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/privileges.c12
-rw-r--r--source3/lib/secdesc.c8
2 files changed, 14 insertions, 6 deletions
diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c
index 5fa9fd7a7d..cd6494d1ed 100644
--- a/source3/lib/privileges.c
+++ b/source3/lib/privileges.c
@@ -719,10 +719,14 @@ NTSTATUS dup_luid_attr(TALLOC_CTX *mem_ctx, LUID_ATTR **new_la, LUID_ATTR *old_l
if ( !old_la )
return NT_STATUS_OK;
- *new_la = TALLOC_ARRAY(mem_ctx, LUID_ATTR, count);
- if ( !*new_la ) {
- DEBUG(0,("dup_luid_attr: failed to alloc new LUID_ATTR array [%d]\n", count));
- return NT_STATUS_NO_MEMORY;
+ if (count) {
+ *new_la = TALLOC_ARRAY(mem_ctx, LUID_ATTR, count);
+ if ( !*new_la ) {
+ DEBUG(0,("dup_luid_attr: failed to alloc new LUID_ATTR array [%d]\n", count));
+ return NT_STATUS_NO_MEMORY;
+ }
+ } else {
+ *new_la = NULL;
}
for (i=0; i<count; i++) {
diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c
index 762dc2f6d8..510282bbfb 100644
--- a/source3/lib/secdesc.c
+++ b/source3/lib/secdesc.c
@@ -480,8 +480,12 @@ SEC_DESC_BUF *se_create_child_secdesc(TALLOC_CTX *ctx, SEC_DESC *parent_ctr,
the_acl = parent_ctr->dacl;
- if (!(new_ace_list = TALLOC_ARRAY(ctx, SEC_ACE, the_acl->num_aces)))
- return NULL;
+ if (the_acl->num_aces) {
+ if (!(new_ace_list = TALLOC_ARRAY(ctx, SEC_ACE, the_acl->num_aces)))
+ return NULL;
+ } else {
+ new_ace_list = NULL;
+ }
for (i = 0; i < the_acl->num_aces; i++) {
SEC_ACE *ace = &the_acl->aces[i];