Skip to content

Commit c5c8bbf

Browse files
author
Jang Myeongho
committed
avoid leaks (compatibility_converter)
1 parent dc4b10e commit c5c8bbf

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/ifcparse/IfcCharacterDecoder.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ void IfcCharacterDecoder::addChar(std::stringstream& s,const UChar32& ch) {
9090
IfcCharacterDecoder::IfcCharacterDecoder(IfcParse::File* f) {
9191
file = f;
9292
#ifdef HAVE_ICU
93-
if (destination != nullptr) {
94-
ucnv_close(destination);
95-
}
93+
if (destination) ucnv_close(destination);
94+
if (compatibility_converter) ucnv_close(compatibility_converter);
9695
destination = nullptr;
96+
compatibility_converter = nullptr;
9797

9898
if (mode == DEFAULT) {
9999
destination = ucnv_open(nullptr, &status);
@@ -112,8 +112,10 @@ IfcCharacterDecoder::~IfcCharacterDecoder() {
112112
#ifdef HAVE_ICU
113113
if ( destination ) ucnv_close(destination);
114114
if ( converter ) ucnv_close(converter);
115+
if ( compatibility_converter ) ucnv_close(compatibility_converter);
115116
destination = nullptr;
116117
converter = nullptr;
118+
compatibility_converter = nullptr;
117119
#endif
118120
}
119121
IfcCharacterDecoder::operator std::string() {

0 commit comments

Comments
 (0)