summaryrefslogtreecommitdiff
path: root/gtk/language-names.c
diff options
context:
space:
mode:
authorPeter Bloomfield <peterbloomfield@bellsouth.net>2020-09-17 23:34:03 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-09-17 23:34:03 +0000
commit50f373fbc2a238a013e7f84de8431741dc388c7a (patch)
treef658dd49b13651416d625b8eaaf208490db26b9d /gtk/language-names.c
parentf2f0a9ee0ee94b952de339b536a7a3812df213fb (diff)
downloadgtk+-50f373fbc2a238a013e7f84de8431741dc388c7a.tar.gz
language-names: Do not g_free() a GError
It's NULL anyway, so freeing GError with g_free() when it's allocated with GSlice never actually happens, but it just looks bad.
Diffstat (limited to 'gtk/language-names.c')
-rw-r--r--gtk/language-names.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gtk/language-names.c b/gtk/language-names.c
index dd9ec7e5fb..8928366ab7 100644
--- a/gtk/language-names.c
+++ b/gtk/language-names.c
@@ -179,9 +179,9 @@ languages_variant_init (const char *variant)
{
gboolean res;
gsize buf_len;
- char *buf = NULL;
- char *filename = NULL;
- GError *error = NULL;
+ char *buf;
+ char *filename;
+ GError *error;
bindtextdomain (variant, ISO_CODES_LOCALESDIR);
bind_textdomain_codeset (variant, "UTF-8");
@@ -196,16 +196,20 @@ languages_variant_init (const char *variant)
ctx = g_markup_parse_context_new (&parser, 0, NULL, NULL);
- g_free (error);
- error = NULL;
res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
g_free (ctx);
if (!res)
- g_warning ("Failed to parse '%s': %s\n", filename, error->message);
+ {
+ g_warning ("Failed to parse '%s': %s\n", filename, error->message);
+ g_error_free (error);
+ }
}
else
- g_warning ("Failed to load '%s': %s\n", filename, error->message);
+ {
+ g_warning ("Failed to load '%s': %s\n", filename, error->message);
+ g_error_free (error);
+ }
g_free (filename);
g_free (buf);