From fc9b67cbc734ac9cd5584a2954f6188023ca4396 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Mon, 6 Aug 2007 03:55:13 +0000 Subject: [PATCH] Correct use of auto_ptr. --- shibsp/attribute/NameIDAttributeDecoder.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/shibsp/attribute/NameIDAttributeDecoder.cpp b/shibsp/attribute/NameIDAttributeDecoder.cpp index e813bc1..4ed2cda 100644 --- a/shibsp/attribute/NameIDAttributeDecoder.cpp +++ b/shibsp/attribute/NameIDAttributeDecoder.cpp @@ -167,11 +167,11 @@ void NameIDAttributeDecoder::extract( const NameIDType* n, vector& dest, const char* assertingParty, const char* relyingParty ) const { - char* name = toUTF8(n->getName()); - if (name && *name) { + auto_arrayptr name(toUTF8(n->getName())); + if (name.get() && *name.get()) { dest.push_back(NameIDAttribute::Value()); NameIDAttribute::Value& val = dest.back(); - val.m_Name = name; + val.m_Name = name.get(); char* str = toUTF8(n->getFormat()); if (str) { val.m_Format = str; @@ -198,18 +198,17 @@ void NameIDAttributeDecoder::extract( delete[] str; } } - delete[] name; } void NameIDAttributeDecoder::extract( const NameIdentifier* n, vector& dest, const char* assertingParty, const char* relyingParty ) const { - char* name = toUTF8(n->getName()); - if (name && *name) { + auto_arrayptr name(toUTF8(n->getName())); + if (name.get() && *name.get()) { dest.push_back(NameIDAttribute::Value()); NameIDAttribute::Value& val = dest.back(); - val.m_Name = name; + val.m_Name = name.get(); char* str = toUTF8(n->getFormat()); if (str) { val.m_Format = str; @@ -226,5 +225,4 @@ void NameIDAttributeDecoder::extract( if (relyingParty) val.m_SPNameQualifier = relyingParty; } - delete[] name; } -- 2.1.4