Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [patches] freeing NULL ptrs
Home

[Freeciv-Dev] Re: [patches] freeing NULL ptrs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Justin Moore <justin@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [patches] freeing NULL ptrs
From: Kevin Brown <kevin@xxxxxxxxxxxxxx>
Date: Fri, 17 Aug 2001 12:29:20 -0700

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?

Probably.  It might be helpful, too, to have that same function
assert(ptr != NULL) first if compiled with debugging turned on, so
that any instances where the code tries to free a NULL can be tracked
down and, if necessary, fixed.


-- 
Kevin Brown                                           kevin@xxxxxxxxxxxxxx

    It's really hard to define what "unexpected behavior" means when you're
                       talking about Windows.


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