GKeyfile: don't leak on failed get_(u)int64
authorRyan Lortie <desrt@desrt.ca>
Tue, 22 Oct 2013 20:24:41 +0000 (16:24 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 22 Oct 2013 20:24:41 +0000 (16:24 -0400)
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 <astonecc@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=710313

glib/gkeyfile.c

index cf063e1..b3fcb67 100644 (file)
@@ -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;
     }