[Freeciv-Dev] Re: [patches] freeing NULL ptrs
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Justin Moore <justin@xxxxxxxxxxx> wrote:
>
> Some allocation and freeing tools turned up a few places where we were
> freeing NULL pointers in common/registry.c and server/ruleset.c. Patches
> against 1.12.0 included. I had suspected there was some heap corruption
> going on, but didn't know exactly where until now.
>
> -jdm
>
> PS. Would it be worth it to create a fc_free that ignores all NULL
> pointers passed to it?
I thought ANSI C requires that free(NULL) is a no-op? K&R2 implies
this. Are there any compilers that we care about that behave
differently?
Nevertheless I like this patch because of the parts which explicitly
set the variable to NULL after free(), since that ensures it won't
accidently be free'd again later.
-- David
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
- [Freeciv-Dev] [patches] freeing NULL ptrs, Justin Moore, 2001/08/17
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Justin Moore, 2001/08/17
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Kevin Brown, 2001/08/17
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Raimar Falke, 2001/08/19
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Ross W. Wetmore, 2001/08/19
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Raimar Falke, 2001/08/19
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Kevin Brown, 2001/08/19
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Justin Moore, 2001/08/19
- [Freeciv-Dev] Re: [patches] freeing NULL ptrs, Raimar Falke, 2001/08/19
[Freeciv-Dev] Re: [patches] freeing NULL ptrs,
David Pfitzner <=
|
|