fix memleak due to autolaunch and recursive calls to _dbus_open_transport
authorJohn (J5) Palmieri <johnp@redhat.com>
Thu, 3 Apr 2008 20:08:40 +0000 (16:08 -0400)
committerJohn (J5) Palmieri <johnp@redhat.com>
Thu, 3 Apr 2008 20:08:40 +0000 (16:08 -0400)
* Patch from Sumit <sumitskj_20@yahoo.com>, comments added

* dbus/dbus-transport.c(_dbus_transport_open): fix mem leak

ChangeLog
dbus/dbus-transport.c

index edca811..5f9f4df 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2008-04-03  John (J5) Palmieri <johnp@redhat.com>
 
+       Patch from Sumit <sumitskj_20@yahoo.com>, comments added
+
+       * dbus/dbus-transport.c(_dbus_transport_open): fix mem leak
+
+2008-04-03  John (J5) Palmieri <johnp@redhat.com>
+
        * dbus/dbus-connection.c (dbus_connection_send): add documentation
          to describe when to call dbus_connection_flush and
          dbus_connection_unref after a call to dbus_connection_send is made
index 313cd41..1e1fc97 100644 (file)
@@ -412,7 +412,22 @@ _dbus_transport_open (DBusAddressEntry *entry,
   else
     {
       _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
-      transport->expected_guid = expected_guid;
+
+      /* In the case of autostart the initial guid is NULL
+       * and the autostart transport recursively calls
+       * _dbus_open_transport wich returns a transport
+       * with a guid.  That guid is the definitive one.
+       *
+       * FIXME: if more transports are added they may have
+       * an effect on the expected_guid semantics (i.e. 
+       * expected_guid and transport->expected_guid may
+       * both have values).  This is very unlikely though
+       * we should either throw asserts here for those 
+       * corner cases or refactor the code so it is 
+       * clearer on what is expected and what is not
+       */
+      if(expected_guid)
+        transport->expected_guid = expected_guid;
     }
 
   return transport;