Colossus wrote: [..] > 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 ?
see http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html#g-io-channel-read-line "Reads a line, including the terminating character(s), from a GIOChannel into a newly-allocated string." "newly allocated string" means that for every call to g_io_channel_read_line() new memory is allocated, so for every call you have to free the string. regards, Olivier _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list