[glib] gerror: Don't leak when warning about overwriting an error
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gerror: Don't leak when warning about overwriting an error
- Date: Wed, 6 Nov 2013 09:17:35 +0000 (UTC)
commit 267222873399cadb0feef4009b26fb1109453fcd
Author: Stef Walter <stefw gnome org>
Date: Thu Oct 31 14:39:05 2013 +0100
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 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/glib/gerror.c b/glib/gerror.c
index 2adbdf8..809d0c9 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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]