avoid leaks (compatibility_converter)

This commit is contained in:
Jang Myeongho
2012-06-27 07:49:34 +00:00
parent dc4b10ef74
commit c5c8bbf425
+5 -3
View File
@@ -90,10 +90,10 @@ void IfcCharacterDecoder::addChar(std::stringstream& s,const UChar32& ch) {
IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::File* f) { IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::File* f) {
file = f; file = f;
#ifdef HAVE_ICU #ifdef HAVE_ICU
if (destination != nullptr) { if (destination) ucnv_close(destination);
ucnv_close(destination); if (compatibility_converter) ucnv_close(compatibility_converter);
}
destination = nullptr; destination = nullptr;
compatibility_converter = nullptr;
if (mode == DEFAULT) { if (mode == DEFAULT) {
destination = ucnv_open(nullptr, &status); destination = ucnv_open(nullptr, &status);
@@ -112,8 +112,10 @@ IfcCharacterDecoder::~IfcCharacterDecoder() {
#ifdef HAVE_ICU #ifdef HAVE_ICU
if ( destination ) ucnv_close(destination); if ( destination ) ucnv_close(destination);
if ( converter ) ucnv_close(converter); if ( converter ) ucnv_close(converter);
if ( compatibility_converter ) ucnv_close(compatibility_converter);
destination = nullptr; destination = nullptr;
converter = nullptr; converter = nullptr;
compatibility_converter = nullptr;
#endif #endif
} }
IfcCharacterDecoder::operator std::string() { IfcCharacterDecoder::operator std::string() {