Index: lobby/XmppClient.cpp =================================================================== --- lobby/XmppClient.cpp +++ lobby/XmppClient.cpp @@ -160,6 +163,7 @@ DbgXMPP("XmppClient destroyed"); delete m_registration; delete m_mucRoom; + delete m_sessionManager; // Workaround for memory leak in gloox 1.0/1.0.1 m_client->removePresenceExtension(gloox::ExtCaps); Index: lobby/glooxwrapper/glooxwrapper.h =================================================================== --- lobby/glooxwrapper/glooxwrapper.h +++ lobby/glooxwrapper/glooxwrapper.h @@ -643,8 +643,6 @@ public: Jingle(const gloox::Jingle::Session::Jingle* wrapped, bool owned) : m_Wrapped(wrapped), m_Owned(owned) {} - const PluginList plugins() const; - ICEUDP::Candidate getCandidate() const; }; Index: lobby/glooxwrapper/glooxwrapper.cpp =================================================================== --- lobby/glooxwrapper/glooxwrapper.cpp +++ lobby/glooxwrapper/glooxwrapper.cpp @@ -284,7 +284,9 @@ virtual void handleSessionAction(gloox::Jingle::Action action, gloox::Jingle::Session* session, const gloox::Jingle::Session::Jingle* jingle) { - m_Wrapped->handleSessionAction(action, new glooxwrapper::Jingle::Session(session, false), new glooxwrapper::Jingle::Session::Jingle(jingle, false)); + glooxwrapper::Jingle::Session wrapped_session(session, false); + glooxwrapper::Jingle::Session::Jingle wrapped_jingle(jingle, false); + m_Wrapped->handleSessionAction(action, &wrapped_session, &wrapped_jingle); } virtual void handleSessionActionError(gloox::Jingle::Action UNUSED(action), gloox::Jingle::Session* UNUSED(session), const gloox::Error* UNUSED(error)) @@ -806,14 +808,6 @@ m_Owned = true; } -const glooxwrapper::Jingle::PluginList glooxwrapper::Jingle::Session::Jingle::plugins() const -{ - glooxwrapper::Jingle::PluginList pluginListWrapper; - for (const gloox::Jingle::Plugin* const& plugin : m_Wrapped->plugins()) - pluginListWrapper.push_back(new glooxwrapper::Jingle::Plugin(const_cast(plugin), false)); - return pluginListWrapper; -} - glooxwrapper::Jingle::ICEUDP::Candidate glooxwrapper::Jingle::Session::Jingle::getCandidate() const { const gloox::Jingle::Content* content = static_cast(m_Wrapped->plugins().front()); @@ -850,6 +844,7 @@ gloox::Jingle::PluginList* pluginList = new gloox::Jingle::PluginList(); pluginList->push_back(new gloox::Jingle::ICEUDP(/*local_pwd*/"", /*local_ufrag*/"", *candidateList)); + // Note that sessionInitiate assumes ownership of pluginList, so we do not leak memory here return m_Wrapped->sessionInitiate(new gloox::Jingle::Content(std::string("game-data"), *pluginList)); }