diff -r cbe3ec2d59d2 -r 7c796c1cf1b0 lemon/lgf_writer.h --- a/lemon/lgf_writer.h Wed Oct 01 13:56:40 2008 +0200 +++ b/lemon/lgf_writer.h Sun Oct 05 21:09:01 2008 +0200 @@ -463,7 +463,10 @@ DigraphWriter(const Digraph& digraph, const std::string& fn) : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph), _skip_nodes(false), _skip_arcs(false) { - if (!(*_os)) throw IoError("Cannot write file", fn); + if (!(*_os)) { + delete _os; + throw IoError("Cannot write file", fn); + } } /// \brief Constructor @@ -473,7 +476,10 @@ DigraphWriter(const Digraph& digraph, const char* fn) : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph), _skip_nodes(false), _skip_arcs(false) { - if (!(*_os)) throw IoError("Cannot write file", fn); + if (!(*_os)) { + delete _os; + throw IoError("Cannot write file", fn); + } } /// \brief Destructor @@ -1024,7 +1030,10 @@ GraphWriter(const Graph& graph, const std::string& fn) : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph), _skip_nodes(false), _skip_edges(false) { - if (!(*_os)) throw IoError("Cannot write file", fn); + if (!(*_os)) { + delete _os; + throw IoError("Cannot write file", fn); + } } /// \brief Constructor @@ -1034,7 +1043,10 @@ GraphWriter(const Graph& graph, const char* fn) : _os(new std::ofstream(fn)), local_os(true), _graph(graph), _skip_nodes(false), _skip_edges(false) { - if (!(*_os)) throw IoError("Cannot write file", fn); + if (!(*_os)) { + delete _os; + throw IoError("Cannot write file", fn); + } } /// \brief Destructor @@ -1587,7 +1599,10 @@ /// Construct a section writer, which writes into the given file. SectionWriter(const std::string& fn) : _os(new std::ofstream(fn.c_str())), local_os(true) { - if (!(*_os)) throw IoError("Cannot write file", fn); + if (!(*_os)) { + delete _os; + throw IoError("Cannot write file", fn); + } } /// \brief Constructor @@ -1595,7 +1610,10 @@ /// Construct a section writer, which writes into the given file. SectionWriter(const char* fn) : _os(new std::ofstream(fn)), local_os(true) { - if (!(*_os)) throw IoError("Cannot write file", fn); + if (!(*_os)) { + delete _os; + throw IoError("Cannot write file", fn); + } } /// \brief Destructor