From: Luke Howard Date: Fri, 1 Apr 2011 08:35:19 +0000 (+1100) Subject: Merge branch 'master' into tlv-mic X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=19941283bb04c6b42b8168475522230d15f0a02c;hp=9e77a5fb8523932fc1c77312be13d226fecf00f0;p=moonshot.git Merge branch 'master' into tlv-mic --- diff --git a/mech_eap/util_saml.cpp b/mech_eap/util_saml.cpp index b4ab0ea..245cafd 100644 --- a/mech_eap/util_saml.cpp +++ b/mech_eap/util_saml.cpp @@ -415,18 +415,16 @@ gss_eap_saml_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAtt for (vector::const_iterator a = attrs.begin(); a != attrs.end(); ++a) { const XMLCh *attributeName, *attributeNameFormat; - XMLCh *qualifiedName; XMLCh space[2] = { ' ', 0 }; gss_buffer_desc utf8; - bool ret; attributeName = (*a)->getName(); attributeNameFormat = (*a)->getNameFormat(); if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0') attributeNameFormat = saml2::Attribute::UNSPECIFIED; - qualifiedName = new XMLCh[XMLString::stringLen(attributeNameFormat) + 1 + - XMLString::stringLen(attributeName) + 1]; + XMLCh qualifiedName[XMLString::stringLen(attributeNameFormat) + 1 + + XMLString::stringLen(attributeName) + 1]; XMLString::copyString(qualifiedName, attributeNameFormat); XMLString::catString(qualifiedName, space); XMLString::catString(qualifiedName, attributeName); @@ -434,12 +432,8 @@ gss_eap_saml_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAtt utf8.value = (void *)toUTF8(qualifiedName); utf8.length = strlen((char *)utf8.value); - ret = addAttribute(m_manager, this, &utf8, data); - - delete qualifiedName; - - if (!ret) - return ret; + if (!addAttribute(m_manager, this, &utf8, data)) + return false; } } @@ -449,12 +443,13 @@ gss_eap_saml_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAtt static BaseRefVectorOf * decomposeAttributeName(const gss_buffer_t attr) { - XMLCh *qualifiedAttr = new XMLCh[attr->length + 1]; - XMLString::transcode((const char *)attr->value, qualifiedAttr, attr->length); + BaseRefVectorOf *components; + string str((const char *)attr->value, attr->length); + XMLCh qualifiedAttr[str.length() + 1]; - BaseRefVectorOf *components = XMLString::tokenizeString(qualifiedAttr); + XMLString::transcode(str.c_str(), qualifiedAttr, str.length()); - delete qualifiedAttr; + components = XMLString::tokenizeString(qualifiedAttr); if (components->size() != 2) { delete components;