Colossus wrote:
Hi,
I have a doubt. I call g_io_channel_read_line several times this way:
g_io_channel_read_line ( ioc, &line, NULL, NULL, NULL );
//do some things on line
//shall I g_free (line) here ?
g_io_channel_read_line ( ioc, &line, NULL, NULL, NULL );
//ecc
My doubt is: shall I free line before the second call to
g_io_channel_read_line or I can call g_free ONCE when I don't need to
read anymore ?
This doc says:
http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html#g-io-channel-read-line
"str_return will contain allocated memory if the return is
G_IO_STATUS_NORMAL"
That means every time g_io_channel_read_line is successfull; you
have some newly allocated memory.
It is up to you to free that memory, yes.
Cheers,
-Tristan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list