From 267222873399cadb0feef4009b26fb1109453fcd Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Thu, 31 Oct 2013 14:39:05 +0100 Subject: [PATCH] gerror: Don't leak when warning about overwriting an error While not strictly necessary, this fixes a false positive leak in the tests. https://bugzilla.gnome.org/show_bug.cgi?id=627423 --- glib/gerror.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/glib/gerror.c b/glib/gerror.c index 2adbdf84d..809d0c940 100644 --- a/glib/gerror.c +++ b/glib/gerror.c @@ -587,16 +587,13 @@ g_set_error_literal (GError **err, gint code, const gchar *message) { - GError *new; - if (err == NULL) return; - new = g_error_new_literal (domain, code, message); if (*err == NULL) - *err = new; + *err = g_error_new_literal (domain, code, message); else - g_warning (ERROR_OVERWRITTEN_WARNING, new->message); + g_warning (ERROR_OVERWRITTEN_WARNING, message); } /**