speechd-discuss
[Top][All Lists]
Advanced

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

[PATCH] Convert src/modules to use GLib memory management exclusively.


From: Boris Dusek
Subject: [PATCH] Convert src/modules to use GLib memory management exclusively.
Date: Tue, 28 Sep 2010 15:52:39 +0200

On Sep 28, 2010, at 3:39 PM, Andrei Kholodnyi wrote:

> --- a/src/modules/module_utils.c
> +++ b/src/modules/module_utils.c
> @@ -54,7 +54,7 @@ ssize_t getline (char **lineptr, size_t *n, FILE *f)
>                if ( m++ >= buf_len )
>                {
>                        buf_len += BUFFER_LEN;
> -                        buf = (char *) realloc(buf, buf_len + 1);
> +                        buf = (char *) g_realloc(buf, buf_len + 1);
> 
> Hi Chris,
> 
> you have modified a local version of getline in output.c and module_utils.c
> now it uses g_realloc instead of realloc.
> this version is still conditionally compiled, i.e. normally GNU
> version will be used, which has realloc in it.
> But all strings used in the getline calls are now g_freed.

Yes, now I noticed as well. Getline has part of it's specification that
the buffer is ISO C-malloc'ed, realloc'ed and free'd. Using glib allocation
is wrong here.

Boris



reply via email to

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