Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2006:
[Freeciv-Dev] Re: (PR#15092) get_data_dirs() memory leak
Home

[Freeciv-Dev] Re: (PR#15092) get_data_dirs() memory leak

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: cp.ml.freeciv.dev@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#15092) get_data_dirs() memory leak
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 7 Jan 2006 22:32:59 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Christian Prochaska wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=15092 >
> 
>>[kauf - So 08. Jan 2006, 02:15:37]:
>>
>>On Sat, Jan 07, 2006 at 05:57:56PM -0800, Christian Prochaska wrote:
>>
>>>in utility/shared.c the function "get_data_dirs" allocates memory for a
>>>list of strings, but this memory is never freed. 
>>
>>can or is get_data_dirs() called more than once? Can it be called by a
>>user? If the answer to all of these is "no", then I don't see much of 
>>a problem.

> 
> 
> Ok, I've just learned that "still reachable" reports by valgrind are
> nothing to worry about, because the memory will be freed automatically
> by the operating system. No problem then.

They're not *necessarily* nothing to worry about - you could for 
instance have an indefinitely long linked list, all still reachable, but 
all unnecessary because you forgot to prune the list so it never gets freed.

However in this case, it is not a leak.  The block is allocated just 
once and used through the rest of the program.

-jason





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