[Telepathy-commits] [telepathy-glib/master] contacts_get_attributes: don't leak a GPtrArray if we have no handles
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Mar 4 09:13:19 PST 2009
This occurs if we started from IDs, and they're all invalid.
---
telepathy-glib/contact.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index dd1f346..faf93ca 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -1768,8 +1768,7 @@ contacts_get_attributes (ContactsContext *context)
{
GArray *contact_attribute_interfaces =
context->connection->priv->contact_attribute_interfaces;
- GPtrArray *array = g_ptr_array_sized_new (
- contact_attribute_interfaces->len);
+ GPtrArray *array;
const gchar **supported_interfaces;
guint i;
@@ -1785,6 +1784,8 @@ contacts_get_attributes (ContactsContext *context)
TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACTS));
g_assert (contact_attribute_interfaces != NULL);
+ array = g_ptr_array_sized_new (contact_attribute_interfaces->len);
+
for (i = 0; i < contact_attribute_interfaces->len; i++)
{
GQuark q = g_array_index (contact_attribute_interfaces, GQuark, i);
--
1.5.6.5
More information about the telepathy-commits
mailing list