#46099: sdl2: clang analyzer NULL dereference warning about unit_select_dialog_popup() Open Date: 2022-11-22 22:30 Last Update: 2022-11-28 00:17 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/46099 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=46099 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2022-11-28 00:17 Updated by: cazfi * Status Update from Open to Closed * Resolution Update from Accepted to Fixed --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: cazfi Type: Bugs Status: Closed Priority: 5 - Medium MileStone: 3.0.5 Component: SDL2-client Severity: 5 - Medium Resolution: Fixed --------------------------------------------------------------------- Ticket details: S3_0 (but other branches likely affected): unit_select_dialog_popup() does unit_tile(pUnit). Clang analyzer is worried that it causes reference through NULL pUnit. That's not real problem, as if the tile unit list size is zero, we never reach that part, and pUnit is the topmost unit in the stack. However, the code makes no sense, either. We already know that the unit is in the list of the original ptile, so certainly its tile is ptile. No need to seek for that. If that was not the case, we would be looking value from effectively random unit from the stack like representing all of them. -- 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/46099 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=46099