[glib] GKeyfile: don't leak on failed get_(u)int64



commit 1b592524ff461c8905b43f4fe04ae3bc47d61592
Author: Ryan Lortie <desrt desrt ca>
Date:   Tue Oct 22 16:24:41 2013 -0400

    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 <astonecc gmail com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710313

 glib/gkeyfile.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index cf063e1..b3fcb67 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;
     }
 


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