gerror: Don't leak when warning about overwriting an error
authorStef Walter <stefw@gnome.org>
Thu, 31 Oct 2013 13:39:05 +0000 (14:39 +0100)
committerStef Walter <stefw@gnome.org>
Wed, 6 Nov 2013 09:14:16 +0000 (10:14 +0100)
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

index 2adbdf8..809d0c9 100644 (file)
@@ -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);
 }
 
 /**