Re: Does g_key_file_free() free pointers from g_key_file_get_string()?
- From: Tadej Borovšak <tadeboro gmail com>
- To: Jim George <jimgeorge gmail com>
- Cc: Kris Bahnsen <nevrgonastopme00 gmail com>, gtk-list gnome org
- Subject: Re: Does g_key_file_free() free pointers from g_key_file_get_string()?
- Date: Fri, 17 Jun 2011 10:43:24 +0200
Hello.
> Since the documentation says it's a newly allocated string, I have
> always freed the string when I no longer need it. This hasn't produced
> any ill effects so far. Usually, valgrind will catch problems related
> to freeing pointers to non-heap memory.
Another indicator that returned value should be freed is lack of const
modifier on return value.
If API docs state:
const char * get_something () -> do not free result
char * get_another_thing () -> free result
Cheers,
Tadej
--
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]