memory allocation clarification
jose vilmar estacio de souza
vilmar at informal.com.br
Mon Feb 22 14:04:04 CET 2010
Hi Chris
Thanks for your reply and your work.
Another point where I think that we need pay attention, is the use of
strdup. Perhaps in some situation strings allocated with strdup may be
being released with g_fre function.
On 02/22/2010 08:33 AM, Chris Brannon wrote:
> Jose Vilmar Estacio de Souza wrote:
>
>> Yes, in attach to this message.
>> Basicly the patch tries to replace all class to malloc and free, for
>> g_malloc and g_free. Some calls to strdup were replace for g_strdup.
>>
> Hi Jose,
> Thanks. Sorry it took me a while to reply.
> You have the right idea.
>
> I'm not sure about changing xmalloc, xrealloc,
> and xfree so that they call glib's allocation functions. Those are wrappers
> around the libc routines. I'm inclined to leave them alone, just for
> the sake of code readability.
> Realize that glib's allocation functions don't need to be wrapped, since
> they already abort the program on allocation failure.
> Perhaps it's better to just change the call sites to g_malloc, where needed?
>
> I would leave getline alone as well. That needs to use libc's malloc.
> GNU's libc provides getline for most of us,
> and that version uses malloc internally.
> The getline defined in module_utils.c is provided for Solaris. Evidently,
> they don't link against GNU's libc.
>
> I'll try to send a patch later, and I'll give you credit for your work in
> the commit message.
>
> -- Chris
>
> _______________________________________________
> Speechd mailing list
> Speechd at lists.freebsoft.org
> http://lists.freebsoft.org/mailman/listinfo/speechd
>
More information about the Speechd
mailing list