Complete.Org: Mailing Lists: Archives: freeciv-ai: December 2004:
[freeciv-ai] Re: (PR#9610) AI movemap
Home

[freeciv-ai] Re: (PR#9610) AI movemap

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#9610) AI movemap
From: "Benedict Adamson" <badamson@xxxxxxxxxxx>
Date: Sun, 19 Dec 2004 07:46:49 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=9610 >

The movemap structure seems to mishandle deleted units. When I run 
valgrind on a modified version of Freeciv that uses the movemap patch, 
it reports accesses to deleted 'struct unit's in the 
movemap_iterate_one_turn and movemap_iterate_two_turn macros. I'm not 
sufficiently familiar with the movemap or speclist code to fully 
understand what is going on, but here are my observations.

At first glance, the iterator macros take care to handle deleted units. 
The list holds unit IDs, and the macro uses find_unit_by_id to check 
whether the IDs corresponding to existing units.

But I think something else is actually happening. The list actually 
holds pointers to the unit IDs (&punit->id), which is no safer than 
holding the pointers to the units themselves (punit).

Comments?





[Prev in Thread] Current Thread [Next in Thread]