[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH (speechd)] Refactor output_read_reply and all of its call sites.

From: Luke Yelavich
Subject: [PATCH (speechd)] Refactor output_read_reply and all of its call sites.
Date: Sun, 14 Feb 2010 22:08:26 +1100

On Sat, Feb 13, 2010 at 02:36:12PM EST, Christopher Brannon wrote:
> I changed this function to return a g_string *, rather than a char *.
> Here is the issue with returning char *.
> In most of the call sites, the allocated memory returned by
> output_read_reply was being freed using spd_free, which is a wrapper
> around libc's free() function.
> That storage is allocated by g_malloc.  The glib docs recommend against
> mixing g_malloc and free in this way.
> If the return value is a g_string *, then it can be freed in a safe
> and consistent way, using g_free_string.
> I also fixed some memory leaks along the way.  Most were in the call sites,
> but one was in output_read_reply itself.  On every function invocation,
> getline is used to read data.  However, the storage allocated by getline was
> not being freed.
> Most of the other leaks aren't too notable.

Applied, thanks.


reply via email to

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