[at-spi2-core] Fix some memory leaks
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core] Fix some memory leaks
- Date: Thu, 6 Jan 2011 16:32:55 +0000 (UTC)
commit 850fb83e06e088487e26888e03445beb2cb3cd18
Author: Mike Gorse <mgorse novell com>
Date: Thu Jan 6 10:35:35 2011 -0600
Fix some memory leaks
atspi/atspi-accessible.c | 11 ++++++++---
atspi/atspi-misc.c | 6 ++++++
dbind/dbind.c | 2 +-
3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 11cfd8b..4698ffe 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -372,9 +372,13 @@ atspi_accessible_get_parent (AtspiAccessible *obj, GError **error)
DBUS_TYPE_STRING, &str_parent,
DBUS_TYPE_INVALID);
reply = _atspi_dbus_send_with_reply_and_block (message);
- if (!reply ||
- (strcmp (dbus_message_get_signature (reply), "v") != 0))
+ if (!reply)
return NULL;
+ if (strcmp (dbus_message_get_signature (reply), "v") != 0)
+ {
+ dbus_message_unref (reply);
+ return NULL;
+ }
dbus_message_iter_init (reply, &iter);
dbus_message_iter_recurse (&iter, &iter_variant);
obj->accessible_parent = _atspi_dbus_return_accessible_from_iter (&iter_variant);
@@ -526,6 +530,7 @@ atspi_accessible_get_relation_set (AtspiAccessible *obj, GError **error)
ret = new_array;
dbus_message_iter_next (&iter_array);
}
+ dbus_message_unref (reply);
return ret;
}
@@ -548,7 +553,7 @@ atspi_accessible_get_role (AtspiAccessible *obj, GError **error)
{
dbus_uint32_t role;
/* TODO: Make this a property */
- if (_atspi_dbus_call (obj, atspi_interface_accessible, "GetRole", NULL, "=>u", &role))
+ if (_atspi_dbus_call (obj, atspi_interface_accessible, "GetRole", error, "=>u", &role))
{
obj->cached_properties |= ATSPI_CACHE_ROLE;
obj->role = role;
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 4bc3a78..a981a09 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -485,6 +485,7 @@ handle_get_items (DBusPendingCall *pending, void *user_data)
DBUS_TYPE_INVALID);
g_warning (_("AT-SPI: Error in GetItems, sender=%s, error=%s"), sender, error);
dbus_message_unref (reply);
+ dbus_pending_call_unref (pending);
return;
}
@@ -496,6 +497,7 @@ handle_get_items (DBusPendingCall *pending, void *user_data)
dbus_message_iter_next (&iter_array);
}
dbus_message_unref (reply);
+ dbus_pending_call_unref (pending);
}
/* TODO: Do we stil need this function? */
@@ -843,6 +845,7 @@ get_accessibility_bus ()
(long) BUFSIZ, False,
(Atom) 31, &actual_type, &actual_format,
&nitems, &leftover, &data);
+ XCloseDisplay (bridge_display);
dbus_error_init (&error);
@@ -1169,7 +1172,10 @@ _atspi_dbus_send_with_reply_and_block (DBusMessage *message)
_atspi_process_deferred_messages ((gpointer)TRUE);
dbus_message_unref (message);
if (err.message)
+ {
g_warning (_("AT-SPI: Got error: %s\n"), err.message);
+ dbus_error_free (&err);
+ }
return reply;
}
diff --git a/dbind/dbind.c b/dbind/dbind.c
index 29f50cb..23046f2 100644
--- a/dbind/dbind.c
+++ b/dbind/dbind.c
@@ -27,6 +27,7 @@ set_reply (DBusPendingCall * pending, void *user_data)
SpiReentrantCallClosure* closure = (SpiReentrantCallClosure *) user_data;
closure->reply = dbus_pending_call_steal_reply (pending);
+ dbus_pending_call_unref (pending);
}
DBusMessage *
@@ -99,7 +100,6 @@ dbind_method_call_reentrant_va (DBusConnection *cnx,
if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
{
const char *name = dbus_message_get_error_name (reply);
- dbus_set_error (err, name, g_strdup (""));
goto out;
}
/* demarshal */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]