From ca87b90981e88623589b7d1d42ce5bafcb644213 Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Thu, 3 Apr 2008 16:08:40 -0400 Subject: 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 --- dbus/dbus-transport.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'dbus/dbus-transport.c') diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c index 313cd417..1e1fc97d 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; -- cgit