[glib] Don't leak an error
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Don't leak an error
- Date: Wed, 5 Aug 2015 21:23:16 +0000 (UTC)
commit 905e916573a6a714bfbf513df2bb07bb365ca2a8
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 5 17:18:48 2015 -0400
Don't leak an error
The previous commit introduced a possible memory leak in cases
where we get a G_IO_ERROR_CLOSED error. Make sure to always
free an error, if we got one.
https://bugzilla.gnome.org/show_bug.cgi?id=753278
gio/gdbusobjectmanagerserver.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c
index 6745df0..188c595 100644
--- a/gio/gdbusobjectmanagerserver.c
+++ b/gio/gdbusobjectmanagerserver.c
@@ -929,9 +929,10 @@ g_dbus_object_manager_server_emit_interfaces_added (GDBusObjectManagerServer *ma
object_path,
&array_builder),
&error);
- if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
+ if (error)
{
- g_warning ("Couldn't emit InterfacesAdded signal: %s", error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
+ g_warning ("Couldn't emit InterfacesAdded signal: %s", error->message);
g_error_free (error);
}
out:
@@ -966,9 +967,10 @@ g_dbus_object_manager_server_emit_interfaces_removed (GDBusObjectManagerServer *
object_path,
&array_builder),
&error);
- if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
+ if (error)
{
- g_warning ("Couldn't emit InterfacesRemoved signal: %s", error->message);
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CLOSED))
+ g_warning ("Couldn't emit InterfacesRemoved signal: %s", error->message);
g_error_free (error);
}
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]