diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-12-08 23:53:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-12-08 23:53:38 +0100 |
| commit | f043af026316728c4ac2b84357a77d84082c06a1 (patch) | |
| tree | 1377f2442e5e743e7a5c2dbe28e17af81249d2c9 /src | |
| parent | 05f7b31f3b5994837aa5b1a69db3c5761b34261d (diff) | |
Use a ScopeGuard.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dcp.cc | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |
