From: John (J5) Palmieri Date: Thu, 3 Apr 2008 20:08:40 +0000 (-0400) Subject: fix memleak due to autolaunch and recursive calls to _dbus_open_transport X-Git-Tag: dbus-1.2.1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca87b90981e88623589b7d1d42ce5bafcb644213;p=thirdparty%2Fdbus.git fix memleak due to autolaunch and recursive calls to _dbus_open_transport * Patch from Sumit , comments added * dbus/dbus-transport.c(_dbus_transport_open): fix mem leak --- diff --git a/ChangeLog b/ChangeLog index edca81108..5f9f4df5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-03 John (J5) Palmieri + + Patch from Sumit , comments added + + * dbus/dbus-transport.c(_dbus_transport_open): fix mem leak + 2008-04-03 John (J5) Palmieri * dbus/dbus-connection.c (dbus_connection_send): add documentation diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 313cd4176..1e1fc97d4 100644 --- a/dbus/dbus-transport.c +++ b/dbus/dbus-transport.c @@ -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;