r22554: Fix an assumption that TALLOC_ARRAY(.., 0) != NULL.
authorVolker Lendecke <vlendec@samba.org>
Sat, 28 Apr 2007 13:52:49 +0000 (13:52 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:19:44 +0000 (12:19 -0500)
Volker
(This used to be commit 1f15a8f371f7c56d1a6e67e52f0f184bbd270c84)

source3/groupdb/mapping.c

index 54cffd15882c7291c81701505fb7a58bcde69cb2..46e27d4de68d19160b30ead1add7a27b3f080222 100644 (file)
@@ -578,12 +578,17 @@ NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
        if (!NT_STATUS_IS_OK(result))
                return result;
 
+       *p_num_alias_rids = 0;
+
+       if (num_alias_sids == 0) {
+               TALLOC_FREE(alias_sids);
+               return NT_STATUS_OK;
+       }
+
        *pp_alias_rids = TALLOC_ARRAY(mem_ctx, uint32, num_alias_sids);
        if (*pp_alias_rids == NULL)
                return NT_STATUS_NO_MEMORY;
 
-       *p_num_alias_rids = 0;
-
        for (i=0; i<num_alias_sids; i++) {
                if (!sid_peek_check_rid(domain_sid, &alias_sids[i],
                                        &(*pp_alias_rids)[*p_num_alias_rids]))