[glib] gdbus-codegen: Fix leak in property setter
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gdbus-codegen: Fix leak in property setter
- Date: Thu, 28 Nov 2013 13:33:03 +0000 (UTC)
commit 49fc6d5b7e0714e783565f083aaca1de598256c0
Author: djcb <djcb djcbsoftware nl>
Date: Thu Nov 28 08:25:20 2013 -0500
gdbus-codegen: Fix leak in property setter
Comparing the code generated for the setter and other methods without
(real) return value, I noticed that the setter does not unref the
gvariant it gets.
https://bugzilla.gnome.org/show_bug.cgi?id=719472
gio/gdbus-2.0/codegen/codegen.py | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index 82e5787..e72cb31 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -1629,14 +1629,20 @@ class CodeGenerator:
'{\n'%(i.name_lower))
self.c.write(' const _ExtendedGDBusPropertyInfo *info = user_data;\n'
' GError *error;\n'
+ ' GVariant *_ret;\n'
' error = NULL;\n'
- ' if (!g_dbus_proxy_call_finish (proxy, res, &error))\n'
+ ' _ret = g_dbus_proxy_call_finish (proxy, res, &error);\n'
+ ' if (!_ret)\n'
' {\n'
' g_warning ("Error setting property \'%%s\' on interface %s: %%s (%%s,
%%d)",\n'
' info->parent_struct.name, \n'
' error->message, g_quark_to_string (error->domain),
error->code);\n'
' g_error_free (error);\n'
' }\n'
+ ' else\n'
+ ' {\n'
+ ' g_variant_unref (_ret);\n'
+ ' }\n'
%(i.name))
self.c.write('}\n'
'\n')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]