Bug 32116

Summary: TpBaseConnectionManager leaks legacy protocol objects
Product: Telepathy Reporter: Olli Salli <ollisal>
Component: tp-glibAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: trivial    
Priority: medium Keywords: patch
Version: 0.12   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=shortlog;h=refs/heads/012-leaked-protocol
Whiteboard: review+
i915 platform: i915 features:

Description Olli Salli 2010-12-05 13:21:52 UTC
tp_base_connection_manager_register does:

  if (cls->protocol_params != NULL)
    {
      for (i = 0; cls->protocol_params[i].name != NULL; i++)
        {
          tp_base_connection_manager_add_protocol (self,
              _tp_legacy_protocol_new (self, cls->protocol_params + i));
        }
    }

and add_protocol does:

  g_hash_table_insert (self->priv->protocols,
      g_strdup (tp_base_protocol_get_name (protocol)),
      g_object_ref (protocol));

and obviously, there is just one unref in total, from the value destructor specified when creating the protocols hash table. I guess the protocol object can't be made GInitiallyUnowned; just unref the protocol manually using a temp var in register()?
Comment 1 Simon McVittie 2010-12-06 02:05:14 UTC
Also affects the 0.12 stable branch. Not problematic in practice, since in a real CM, the TpBaseConnectionManager subclass is constructed during initialization and not released until the process exits.
Comment 2 Simon McVittie 2010-12-06 02:16:03 UTC
This seems to work.
Comment 3 Jonny Lamb 2010-12-06 06:53:45 UTC
wowzer
Comment 4 Simon McVittie 2010-12-06 08:21:26 UTC
Fixed in git for 0.12.6 and 0.13.9.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.