summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2011-01-20 14:55:50 -0500
committerRyan Lortie <desrt@desrt.ca>2011-01-20 14:55:50 -0500
commit80a5c1a5d0db2953b815255c99ceeaedb5408ae1 (patch)
treea58d5c1eced3ee39dd5213adcfd12e1ba6d2bb4c /service
parenteab034562ed664d48fdbb0e713449b33a0803c9f (diff)
downloaddconf-80a5c1a5d0db2953b815255c99ceeaedb5408ae1.tar.gz
Check for value == NULL before unref()
If a key reset is being done, then the 'value' variable in the write call will be NULL.
Diffstat (limited to 'service')
-rw-r--r--service/service.c9
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);
}