Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] Re: (PR#8975) cm clear_cache() called before build_cache3(
Home

[Freeciv-Dev] Re: (PR#8975) cm clear_cache() called before build_cache3(

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: use_less@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8975) cm clear_cache() called before build_cache3()
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 13 Jun 2004 09:33:42 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8975 >

James Canete wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8975 >
> 
> In aicore/cm.c, it seems as though clear_cache() is called before
> build_cache3() when loading a save on a fresh server, leading to a null
> pointer dereference.
> 
> To reproduce:
> 1. Apply cm-assert.diff and compile.
> 2. Start server and load cm-crash.sav.gz. 
> 3. Assert triggered.

But without the assert added in there is no NULL dereference.  The 
pointer is NULL but it's never dereferenced.

Also, this code is called because server_game_free() is called when you 
load a savegame.  This is because you may load in the middle of a game 
or something.  But since there is no known ruleset or server parameters 
at this point it's not possible to allocate cache3.result earlier.  The 
only real way to "fix" it is to avoid calling server_game_free() if 
there's no game in progress.  But since this bug isn't fatal AFAICT I 
don't see why this would be necessary.

jason




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