[dconf] Check for value == NULL before unref()
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] Check for value == NULL before unref()
- Date: Thu, 20 Jan 2011 19:57:04 +0000 (UTC)
commit 80a5c1a5d0db2953b815255c99ceeaedb5408ae1
Author: Ryan Lortie <desrt desrt ca>
Date: Thu Jan 20 14:55:50 2011 -0500
Check for value == NULL before unref()
If a key reset is being done, then the 'value' variable in the write
call will be NULL.
service/service.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/service/service.c b/service/service.c
index c5e12c8..54418d1 100644
--- a/service/service.c
+++ b/service/service.c
@@ -156,14 +156,16 @@ method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"can not set value to path");
- g_variant_unref (value);
+ if (value != NULL)
+ g_variant_unref (value);
return;
}
if (!dconf_writer_write (writer, key, value, &error))
{
g_dbus_method_invocation_return_gerror (invocation, error);
- g_variant_unref (value);
+ if (value != NULL)
+ g_variant_unref (value);
g_error_free (error);
return;
}
@@ -179,7 +181,8 @@ method_call (GDBusConnection *connection,
g_variant_new ("(s ass)",
key, none, tag),
NULL);
- g_variant_unref (value);
+ if (value != NULL)
+ g_variant_unref (value);
g_free (path);
g_free (tag);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]