From eb5f47f5c5b96af42c1633b371909b5c37ab6e90 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Wed, 15 Nov 2017 11:58:13 +0200 Subject: [PATCH] OpenDDLParser: Fix potential memory leak --- contrib/openddlparser/code/OpenDDLParser.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index dab976fad..c42fc9d57 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include #ifdef _WIN32 @@ -275,12 +276,12 @@ char *OpenDDLParser::parseHeader( char *in, char *end ) { } delete id; - Name *name(ddl_nullptr); - in = OpenDDLParser::parseName(in, end, &name); + Name *name_(ddl_nullptr); + in = OpenDDLParser::parseName(in, end, &name_); + std::unique_ptr name(name_); if( ddl_nullptr != name && ddl_nullptr != node ) { const std::string nodeName( name->m_id->m_buffer ); node->setName( nodeName ); - delete name; }