Merge branch 'g_strerror_error_leak' into 'main'

Fix a memory leak in g_strerror

See merge request GNOME/glib!3305
This commit is contained in:
Emmanuele Bassi 2023-03-02 16:37:37 +00:00
commit 48e62795f6

View File

@ -1369,7 +1369,10 @@ g_strerror (gint errnum)
{
msg = g_locale_to_utf8 (msg, -1, NULL, NULL, &error);
if (error)
g_print ("%s\n", error->message);
{
g_print ("%s\n", error->message);
g_error_free (error);
}
}
else if (msg == (const gchar *)buf)
msg = g_strdup (buf);