From: Stef Walter Date: Thu, 31 Oct 2013 13:39:05 +0000 (+0100) Subject: gerror: Don't leak when warning about overwriting an error X-Git-Tag: 2.39.1~80 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=267222873399cadb0feef4009b26fb1109453fcd;p=platform%2Fupstream%2Fglib.git 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 --- 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); } /**