summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-20 12:51:18 +0000
committerGeorge Kiagiadakis <gkiagia@tolabaki.gr>2016-09-02 21:16:40 +0300
commit43afd2866bc38efe1b2cf27989df4e36ddd21201 (patch)
treeaa061a0f8bfac8f57c3dacd8054937bafb281945
parente49b61b4e0f94f2e740ff5a0d231b43f37ab7d1b (diff)
downloadtelepathy-mission-control-43afd2866bc38efe1b2cf27989df4e36ddd21201.tar.gz
fix memory leaks: dbus_g_method_get_sender returns a copy
We were semi-consistently using it wrong.
-rw-r--r--src/mcd-dispatch-operation.c12
-rw-r--r--src/mcd-dispatcher.c4
2 files changed, 9 insertions, 7 deletions
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 0f2850fe..4948b6be 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -521,10 +521,7 @@ _mcd_dispatch_operation_check_client_locks (McdDispatchOperation *self)
/* if we've been claimed, respond, then do not call HandleChannels */
if (approval != NULL && approval->type == APPROVAL_TYPE_CLAIM)
{
- /* this needs to be copied because we don't use it til after we've
- * freed approval->context */
- gchar *caller = g_strdup (dbus_g_method_get_sender (
- approval->context));
+ gchar *caller = dbus_g_method_get_sender (approval->context);
/* remove this approval from the list, so it won't be treated as a
* failure */
@@ -827,13 +824,16 @@ _mcd_dispatch_operation_finish (McdDispatchOperation *operation,
approval != NULL;
approval = g_queue_pop_head (priv->approvals))
{
+ gchar *caller;
+
switch (approval->type)
{
case APPROVAL_TYPE_CLAIM:
/* someone else got it - either another Claim() or a handler */
g_assert (approval->context != NULL);
- DEBUG ("denying Claim call from %s",
- dbus_g_method_get_sender (approval->context));
+ caller = dbus_g_method_get_sender (approval->context);
+ DEBUG ("denying Claim call from %s", caller);
+ g_free (caller);
dbus_g_method_return_error (approval->context, priv->result);
approval->context = NULL;
break;
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index 5fea7f27..2fc08286 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -2123,7 +2123,7 @@ dispatcher_delegate_channels (
{
McdDispatcher *self = (McdDispatcher *) iface;
GError *error = NULL;
- const gchar *sender;
+ gchar *sender = NULL;
McdConnection *conn = NULL;
DelegateChannelsCtx *ctx = NULL;
McdAccountManager *am;
@@ -2208,11 +2208,13 @@ dispatcher_delegate_channels (
try_delegating (to_delegate);
}
+ g_free (sender);
g_object_unref (am);
return;
error:
+ g_free (sender);
dbus_g_method_return_error (context, error);
g_error_free (error);