s4 auth_winbind: Don't allocate the rids for the info3 structure within the loop
authorKai Blin <kai@samba.org>
Thu, 25 Jun 2009 17:38:51 +0000 (19:38 +0200)
committerKai Blin <kai@samba.org>
Thu, 25 Jun 2009 17:38:51 +0000 (19:38 +0200)
source4/auth/ntlm/auth_winbind.c

index a41c37e27e14979c527a47c801e806c223cfe84f..3905d00667102212bcfa15b9f92e3bf5b5a26c95 100644 (file)
@@ -157,12 +157,12 @@ static NTSTATUS get_info3_from_wbcAuthUserInfo(TALLOC_CTX *mem_ctx,
 
        /* We already handled the first two, now take care of the rest */
        info3->base.groups.count = info->num_sids - 2;
-       for (i = 2, j = 0; i < info->num_sids; ++i, ++j) {
 
-               rids = talloc_array(mem_ctx, struct samr_RidWithAttribute,
-                                   info3->base.groups.count);
-               NT_STATUS_HAVE_NO_MEMORY(rids);
+       rids = talloc_array(mem_ctx, struct samr_RidWithAttribute,
+                           info3->base.groups.count);
+       NT_STATUS_HAVE_NO_MEMORY(rids);
 
+       for (i = 2, j = 0; i < info->num_sids; ++i, ++j) {
                rids[j].attributes = info->sids[i].attributes;
                dom_sid_split_rid(mem_ctx,
                                  (struct dom_sid2 *) &info->sids[i].sid,