Does g_key_file_free() free pointers from g_key_file_get_string()?

Working on a project and encountered g_key_file for the first time.  I have a question with the API, what happens to strings returned by g_key_file_get_string? Are they freed when you free the key_file? Are they just magically garbage collected? Must they be freed manually?  What got me asking this is the verbiage of the API:

"Returns: a newly allocated string or NULL if the specified key cannot be found"

While g_strndup() says"
"Returns: a newly-allocated buffer containing the first n bytes of str, nul-terminated"

g_strndup() description explicitly says that the return value should be freed when no longer needed, but g_key_file_get_string() says no such thing.  I was unable to find any write-up describing the difference between a "string" or a "buffer" in the sense of the return value of either of those two functions.  Both returns are of type gchar *.  Thanks for any clarification you can provide.


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