Fri 15 Jun 2012 07:54:13 PM UTC, comment #4:
The calls to ai_data_init() and ai_data_close() look balanced.
However, the second significant valgrind error ("Invalid write of size 4") is relevant, I think.
When ai_data_init() is called for a player, it allocates ai->government_want according to the government_count() in force at the time.
It looks like ai_data_init() is only called when a player is first created. I'm guessing the problem is that if a player exists over a ruleset reload, that player's government_want remains sized for the old ruleset.
It looks like ai_data_default() is called to reinitialise the player on ruleset reload, but that doesn't reallocate ai->government_want. However it does memset it, based on the new government_count().
Since the civ2 and multiplayer rulesets have an extra government compared to the classic ruleset (Fundamentalism), that memset will overrun.
Is the fix simply to reallocate government_want in ai_data_default() rather than ai_data_init()?
I'll leave this for someone else...
(The other valgrind error looks unrelated -- although player data applicable to long-gone rulesets is also implicated -- so I've raised it as bug #19814.)
|
Fri 15 Jun 2012 10:45:39 AM UTC, comment #3:
Revision: 21191 ; This is valgrind backtrace :
|
Tue 12 Jun 2012 10:36:30 AM UTC, original submission:
I get a crash when quitting the server after having loaded "multiplayer" or "civ2" rulesets at first turn.
|