... and more mem errors fixed (#7924)

* fixleak in CIP labels catch test

* fix leak in Murtagh clustering

* do not leak writers in streambuf

* fix leaks in fingerprintgeneratorwrapper

* remove 'minor leak' comments
This commit is contained in:
Ricardo Rodriguez
2024-10-25 01:01:34 -04:00
committed by GitHub
parent 7546167033
commit ccfb1fa688
9 changed files with 95 additions and 89 deletions

View File

@@ -529,11 +529,20 @@ class streambuf : public std::basic_streambuf<char> {
exceptions(std::ios_base::badbit);
}
// overload that takes ownership of the streambuf ptr
ostream(streambuf *buf) : std::ostream(buf), m_buf(buf) {
exceptions(std::ios_base::badbit);
}
~ostream() override {
if (this->good()) {
this->flush();
}
delete m_buf;
}
private:
streambuf *m_buf = nullptr;
};
};