lemon/lgf_reader.h
changeset 297 92b193385702
parent 294 cbe3ec2d59d2
child 303 a3a69f5bba62
     1.1 --- a/lemon/lgf_reader.h	Sun Oct 05 12:36:26 2008 +0200
     1.2 +++ b/lemon/lgf_reader.h	Mon Oct 06 11:01:03 2008 +0100
     1.3 @@ -517,7 +517,10 @@
     1.4          _filename(fn), _digraph(digraph),
     1.5          _use_nodes(false), _use_arcs(false),
     1.6          _skip_nodes(false), _skip_arcs(false) {
     1.7 -      if (!(*_is)) throw IoError("Cannot open file", fn);
     1.8 +      if (!(*_is)) {
     1.9 +        delete _is;
    1.10 +        throw IoError("Cannot open file", fn);
    1.11 +      }
    1.12      }
    1.13  
    1.14      /// \brief Constructor
    1.15 @@ -529,7 +532,10 @@
    1.16          _filename(fn), _digraph(digraph),
    1.17          _use_nodes(false), _use_arcs(false),
    1.18          _skip_nodes(false), _skip_arcs(false) {
    1.19 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.20 +      if (!(*_is)) {
    1.21 +        delete _is;
    1.22 +        throw IoError("Cannot open file", fn);
    1.23 +      }
    1.24      }
    1.25  
    1.26      /// \brief Destructor
    1.27 @@ -1308,7 +1314,10 @@
    1.28          _filename(fn), _graph(graph),
    1.29          _use_nodes(false), _use_edges(false),
    1.30          _skip_nodes(false), _skip_edges(false) {
    1.31 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.32 +      if (!(*_is)) {
    1.33 +        delete _is;
    1.34 +        throw IoError("Cannot open file", fn);
    1.35 +      }
    1.36      }
    1.37  
    1.38      /// \brief Constructor
    1.39 @@ -1320,7 +1329,10 @@
    1.40          _filename(fn), _graph(graph),
    1.41          _use_nodes(false), _use_edges(false),
    1.42          _skip_nodes(false), _skip_edges(false) {
    1.43 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.44 +      if (!(*_is)) {
    1.45 +        delete _is;
    1.46 +        throw IoError("Cannot open file", fn);
    1.47 +      }
    1.48      }
    1.49  
    1.50      /// \brief Destructor
    1.51 @@ -2094,7 +2106,10 @@
    1.52      SectionReader(const std::string& fn)
    1.53        : _is(new std::ifstream(fn.c_str())), local_is(true),
    1.54          _filename(fn) {
    1.55 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.56 +      if (!(*_is)) {
    1.57 +        delete _is;
    1.58 +        throw IoError("Cannot open file", fn);
    1.59 +      }
    1.60      }
    1.61  
    1.62      /// \brief Constructor
    1.63 @@ -2103,7 +2118,10 @@
    1.64      SectionReader(const char* fn)
    1.65        : _is(new std::ifstream(fn)), local_is(true),
    1.66          _filename(fn) {
    1.67 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.68 +      if (!(*_is)) {
    1.69 +        delete _is;
    1.70 +        throw IoError("Cannot open file", fn);
    1.71 +      }
    1.72      }
    1.73  
    1.74      /// \brief Destructor
    1.75 @@ -2386,7 +2404,10 @@
    1.76      /// file.
    1.77      LgfContents(const std::string& fn)
    1.78        : _is(new std::ifstream(fn.c_str())), local_is(true) {
    1.79 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.80 +      if (!(*_is)) {
    1.81 +        delete _is;
    1.82 +        throw IoError("Cannot open file", fn);
    1.83 +      }
    1.84      }
    1.85  
    1.86      /// \brief Constructor
    1.87 @@ -2395,7 +2416,10 @@
    1.88      /// file.
    1.89      LgfContents(const char* fn)
    1.90        : _is(new std::ifstream(fn)), local_is(true) {
    1.91 -      if (!(*_is)) throw IoError("Cannot open file", fn);
    1.92 +      if (!(*_is)) {
    1.93 +        delete _is;
    1.94 +        throw IoError("Cannot open file", fn);
    1.95 +      }
    1.96      }
    1.97  
    1.98      /// \brief Destructor