summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <matthias.clasen@gmail.com>2010-08-19 12:25:00 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-08-19 12:25:00 +0200
commit43ed5814cfd8dcfa9817777d6145a270a442f5c7 (patch)
tree41863476982b32a7eb710a6d8c1d98e085206721
parenta4e099c5bff9f9fdb9067a0a6bb206d4c34745ae (diff)
Free GErrors after returning them
dbus_g_method_return_error() does not free or take ownership of the passed GError, we need to free it ourselves. Signed-off-by: Martin Pitt <martin.pitt@ubuntu.com>
-rw-r--r--src/up-daemon.c8
-rw-r--r--src/up-qos.c8
2 files changed, 16 insertions, 0 deletions
diff --git a/src/up-daemon.c b/src/up-daemon.c
index 3fb952b..40bab80 100644
--- a/src/up-daemon.c
+++ b/src/up-daemon.c
@@ -323,6 +323,7 @@ up_daemon_about_to_sleep (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"Sleep has already been requested and is pending");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -376,6 +377,7 @@ up_daemon_deferred_sleep_cb (UpDaemonDeferredSleep *sleep)
"Failed to spawn: %s, stdout:%s, stderr:%s", error_local->message, stdout, stderr);
g_error_free (error_local);
dbus_g_method_return_error (sleep->context, error);
+ g_error_free (error);
goto out;
}
@@ -470,6 +472,7 @@ up_daemon_suspend (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"No kernel support");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -486,6 +489,7 @@ up_daemon_suspend (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"Sleep has already been requested and is pending");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -563,6 +567,7 @@ up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"No kernel support");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -572,6 +577,7 @@ up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"Not enough swap space");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -582,6 +588,7 @@ up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"Swap space is encrypted, use AllowHibernateEncryptedSwap to override");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -598,6 +605,7 @@ up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context)
UP_DAEMON_ERROR_GENERAL,
"Sleep has already been requested and is pending");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
diff --git a/src/up-qos.c b/src/up-qos.c
index 0ce3eea..70f1690 100644
--- a/src/up-qos.c
+++ b/src/up-qos.c
@@ -262,6 +262,7 @@ up_qos_request_latency (UpQos *qos, const gchar *type_text, gint value, gboolean
if (type == UP_QOS_KIND_UNKNOWN) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text);
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -270,6 +271,7 @@ up_qos_request_latency (UpQos *qos, const gchar *type_text, gint value, gboolean
if (sender == NULL) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "no DBUS sender");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -291,6 +293,7 @@ up_qos_request_latency (UpQos *qos, const gchar *type_text, gint value, gboolean
if (!retval) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot get UID");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -299,6 +302,7 @@ up_qos_request_latency (UpQos *qos, const gchar *type_text, gint value, gboolean
if (!retval) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot get PID");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -307,6 +311,7 @@ up_qos_request_latency (UpQos *qos, const gchar *type_text, gint value, gboolean
if (cmdline == NULL) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot get cmdline");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -359,6 +364,7 @@ up_qos_cancel_request (UpQos *qos, guint cookie, DBusGMethodInvocation *context)
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL,
"Cannot find request for #%i", cookie);
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -367,6 +373,7 @@ up_qos_cancel_request (UpQos *qos, guint cookie, DBusGMethodInvocation *context)
if (sender == NULL) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "no DBUS sender");
dbus_g_method_return_error (context, error);
+ g_error_free (error);
goto out;
}
@@ -430,6 +437,7 @@ up_qos_set_minimum_latency (UpQos *qos, const gchar *type_text, gint value, DBus
if (type == UP_QOS_KIND_UNKNOWN) {
error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text);
dbus_g_method_return_error (context, error);
+ g_error_free (error);
return;
}