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.
This commit is contained in:
Peter Bloomfield 2020-09-17 23:34:03 +00:00 committed by Matthias Clasen
parent f2f0a9ee0e
commit 50f373fbc2

View File

@ -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);