summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-08 23:53:38 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-08 23:53:38 +0100
commitf043af026316728c4ac2b84357a77d84082c06a1 (patch)
tree1377f2442e5e743e7a5c2dbe28e17af81249d2c9 /src
parent05f7b31f3b5994837aa5b1a69db3c5761b34261d (diff)
Use a ScopeGuard.
Diffstat (limited to 'src')
-rw-r--r--src/dcp.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dcp.cc b/src/dcp.cc
index 06d4633b..3ba62d35 100644
--- a/src/dcp.cc
+++ b/src/dcp.cc
@@ -234,15 +234,15 @@ DCP::read (vector<dcp::VerificationNote>* notes, bool ignore_incorrect_picture_m
pkl_type == remove_parameters(CPL::static_pkl_type(standard)) ||
pkl_type == remove_parameters(InteropTextAsset::static_pkl_type(standard))) {
auto p = new xmlpp::DomParser;
+ dcp::ScopeGuard sg = [p]() { delete p; };
+
try {
p->parse_file(dcp::filesystem::fix_long_path(path).string());
} catch (std::exception& e) {
- delete p;
throw ReadError(String::compose("XML error in %1", path.string()), e.what());
}
auto const root = p->get_document()->get_root_node()->get_name();
- delete p;
if (root == "CompositionPlaylist") {
auto cpl = make_shared<CPL>(path, notes);