server: Handle possible mem_alloc failure in create_token.

This commit is contained in:
Robert Shearman 2006-04-07 11:16:28 +01:00 committed by Alexandre Julliard
parent d8058fbe8c
commit 9e0d0563c1
1 changed files with 6 additions and 0 deletions

View File

@ -438,6 +438,12 @@ static struct token *create_token( unsigned primary, const SID *user,
{
size_t size = FIELD_OFFSET( struct sid_and_attributes, sid.SubAuthority[((const SID *)groups[i].Sid)->SubAuthorityCount] );
struct sid_and_attributes *group = mem_alloc( size );
if (!group)
{
release_object( token );
return NULL;
}
memcpy( &group->sid, groups[i].Sid, FIELD_OFFSET( SID, SubAuthority[((const SID *)groups[i].Sid)->SubAuthorityCount] ) );
group->enabled = TRUE;
group->def = TRUE;