From c5c8bbf42507e6089a55a1cf9c30769b181ca8e3 Mon Sep 17 00:00:00 2001 From: Jang Myeongho Date: Wed, 27 Jun 2012 07:49:34 +0000 Subject: [PATCH] avoid leaks (compatibility_converter) --- src/ifcparse/IfcCharacterDecoder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ifcparse/IfcCharacterDecoder.cpp b/src/ifcparse/IfcCharacterDecoder.cpp index 54f915ddd0..6afd0cba6a 100644 --- a/src/ifcparse/IfcCharacterDecoder.cpp +++ b/src/ifcparse/IfcCharacterDecoder.cpp @@ -90,10 +90,10 @@ void IfcCharacterDecoder::addChar(std::stringstream& s,const UChar32& ch) { IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::File* f) { file = f; #ifdef HAVE_ICU - if (destination != nullptr) { - ucnv_close(destination); - } + if (destination) ucnv_close(destination); + if (compatibility_converter) ucnv_close(compatibility_converter); destination = nullptr; + compatibility_converter = nullptr; if (mode == DEFAULT) { destination = ucnv_open(nullptr, &status); @@ -112,8 +112,10 @@ IfcCharacterDecoder::~IfcCharacterDecoder() { #ifdef HAVE_ICU if ( destination ) ucnv_close(destination); if ( converter ) ucnv_close(converter); + if ( compatibility_converter ) ucnv_close(compatibility_converter); destination = nullptr; converter = nullptr; + compatibility_converter = nullptr; #endif } IfcCharacterDecoder::operator std::string() {