From 1b592524ff461c8905b43f4fe04ae3bc47d61592 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Tue, 22 Oct 2013 16:24:41 -0400 Subject: [PATCH] GKeyfile: don't leak on failed get_(u)int64 In the case that g_key_file_get_(u)int64 fails to parse the integer, make sure we free the string before returning. Reported by Andrew Stone https://bugzilla.gnome.org/show_bug.cgi?id=710313 --- glib/gkeyfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index cf063e173..b3fcb679e 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -2614,6 +2614,7 @@ g_key_file_get_int64 (GKeyFile *key_file, _("Key '%s' in group '%s' has value '%s' " "where %s was expected"), key, group_name, s, "int64"); + g_free (s); return 0; } @@ -2690,6 +2691,7 @@ g_key_file_get_uint64 (GKeyFile *key_file, _("Key '%s' in group '%s' has value '%s' " "where %s was expected"), key, group_name, s, "uint64"); + g_free (s); return 0; }