X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fbinding%2Fimpl%2FArtifactMap.cpp;fp=saml%2Fbinding%2Fimpl%2FArtifactMap.cpp;h=6dd3fbba2d2cd671c8a1ed39270bbca1de533659;hb=59f8e99deb7181862dbc717e2ee74542667e19d0;hp=62a60adcfdc8505d1fcdaf9f64abda3f3b996eba;hpb=b200befa360fe74b3b8865a654f54a6647723755;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/binding/impl/ArtifactMap.cpp b/saml/binding/impl/ArtifactMap.cpp index 62a60ad..6dd3fbb 100644 --- a/saml/binding/impl/ArtifactMap.cpp +++ b/saml/binding/impl/ArtifactMap.cpp @@ -64,8 +64,11 @@ namespace opensaml { private: struct SAML_DLLLOCAL Mapping { - Mapping() : m_expires(0) {} - auto_ptr m_xml; + Mapping() : m_xml(nullptr), m_expires(0) {} + ~Mapping() { + delete m_xml; + } + XMLObject* m_xml; string m_relying; time_t m_expires; }; @@ -109,17 +112,18 @@ void ArtifactMappings::storeContent(XMLObject* content, const SAMLArtifact* arti time_t now = time(nullptr); multimap::iterator stop = m_expMap.upper_bound(now); for (multimap::iterator i = m_expMap.begin(); i != stop; m_expMap.erase(i++)) { + delete m_artMap[i->second].m_xml; m_artMap.erase(i->second); } // Key is the hexed handle. string hexed = SAMLArtifact::toHex(artifact->getMessageHandle()); Mapping& m = m_artMap[hexed]; - m.m_xml.reset(content); + m.m_xml = content; if (relyingParty) m.m_relying = relyingParty; m.m_expires = now + TTL; - m_expMap.insert(pair(m.m_expires,hexed)); + m_expMap.insert(pair(m.m_expires, hexed)); } XMLObject* ArtifactMappings::retrieveContent(const SAMLArtifact* artifact, const char* relyingParty) @@ -148,7 +152,8 @@ XMLObject* ArtifactMappings::retrieveContent(const SAMLArtifact* artifact, const } log.debug("resolved artifact for (%s)", relyingParty ? relyingParty : "unknown"); - XMLObject* ret = i->second.m_xml.release(); + XMLObject* ret = i->second.m_xml; + i->second.m_xml = nullptr; // clear member so it doesn't get deleted removeMapping(i); return ret; }