A few more minor fixes geared towards lgtm.com alerts (#6127)

* Remove unfilled formatting placeholders in KLT parser.
* Fix presumably unintentionally missing reference on PlanatPtr and ChunkyPtr call operators.
* Fix catching pointer and make use-after-free of workimg easier to spot.
Make sure all of our thrown exceptions derive from std::exception and then catch
by reference instead of by pointer.
* Fix mismatch between array form new and non-array form delete.
* Simplify memory management of embedded color profiles by unifying allocation to use operator new.
This commit is contained in:
Adam Reichold
2021-03-17 08:37:19 +01:00
committed by GitHub
parent 537fa73d3f
commit fae40a137a
9 changed files with 22 additions and 37 deletions

View File

@@ -196,7 +196,7 @@ rtengine::LCPProfile::LCPProfile(const Glib::ustring& fname) :
XML_Parser parser = XML_ParserCreate(nullptr);
if (!parser) {
throw "Couldn't allocate memory for XML parser";
throw std::runtime_error("Couldn't allocate memory for XML parser");
}
XML_SetElementHandler(parser, XmlStartHandler, XmlEndHandler);
@@ -216,7 +216,7 @@ rtengine::LCPProfile::LCPProfile(const Glib::ustring& fname) :
if (XML_Parse(parser, buf, bytesRead, done) == XML_STATUS_ERROR) {
XML_ParserFree(parser);
throw "Invalid XML in LCP file";
throw std::runtime_error("Invalid XML in LCP file");
}
} while (!done);