#48290: team_new() NULL tslot reference Open Date: 2023-06-25 16:46 Last Update: 2023-06-25 16:46 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/48290 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48290 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2023-06-25 16:46 Updated by: cazfi * New Ticket "team_new() NULL tslot reference" created --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: (None) Type: Bugs Status: Open Priority: 5 - Medium MileStone: (None) Component: General Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: Clang analyzer S3_1: ../../../src/common/team.c:340:15: warning: Access to field 'team' results in a dereference of a null pointer (loaded from variable 'tslot') [core.NullDereference] tslot->team = pteam; I think there's an actual bug that tslot IS left as NULL after the ealier iteration to find a free slot. When called from team_add_player() there might be max number of both players and teams already (both MAX_NUM_PLAYER_SLOTS), *and* the attempt to create a new team is before freeing the old one. -- Ticket information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/48290 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=48290