Thanks, Daniel:
I added "clntcore_path = NULL" when I commit.
>-----Original Message-----
>From: Daniel Yek [mailto:dyek real.com]
>Sent: 2007定10埖26晩 12:21
>To: Zhao, Halley
>Cc: player-dev helixcommunity.org
>Subject: Re: Add splay (Atlas310) as Helix
engine(client core) for Helix
>dbus-server
>
>
>Greg Wright wrote:
>> This is a memory leak. EACH time you call
g_build_filename you
>> NEED to call g_free(clntcore_path).
>
>> It looks like it was a memory leak before as
well.
>>
>> + g_debug("helix-dbus-server running
against %s", clntcore_path);
>> + g_free(clntcore_path);
>>
>> make sure you are not double-free'ing something
here.
>
>Zhao, Halley wrote:
>> Hi Greg:
>> You can refer the whole code below (the
patch file doesn't express
>it well); I think the clntcore_path is freed each
time.
>> When the client core path is found, there
is a "break" from the loop,
>then the following code can free it after using.
>>
>
>My opinion is that it is a good practice to set the
variable to NULL
>after freeing the memory. It is too easy for someone
to change the flow
>of the code a little and you get a double free. If
you were to set it to
>NULL, that would not happen.
>
>--
>Daniel Yek.
>
_______________________________________________
Player-dev mailing list
Player-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/play
er-dev
|