GNOME Bugzilla – Bug 169348
get_special_folder() leakage
Last modified: 2005-03-09 02:31:06 UTC
In gutils.c, get_special_folder() returns the value returned by g_utf16_to_utf8() or g_locale_to_utf8(), both of which return strings that need to be freed (although g_locale_to_utf8() doesn't specifically mention it in the API documentation). Some places that get_special_folder() is used do not free the returned value correctly (because it is being used in conjunction with static strings and g_getenv() for non-windows application. I don't see a way to attach a patch as part of the bug report step, so i'll attach it as an additional step. :)
Created attachment 38324 [details] [review] Fix leaked retval of get_special_folder()
But on the other hand the leaks happen only once each, don't they?
Yes, they should happen only once. I only noticed it while looking into Bug #169349, I didn't set out looking for leaks.
Created attachment 38442 [details] [review] Improved patch Improved patch that also guards against g_home_dir being NULL in these functions. Also don't pass a NULL first parameter to g_strsplit().
Committed to HEAD and glib-2-6.