diff --git a/io/las/LasReader.hpp b/io/las/LasReader.hpp index 786dc00c27..884f78ba6c 100644 --- a/io/las/LasReader.hpp +++ b/io/las/LasReader.hpp @@ -57,10 +57,12 @@ class PDAL_DLL LasReader : public pdal::Reader { friend class NitfReader; public: - LasReader() : pdal::Reader(), m_index(0), - m_istream(NULL) + LasReader() : pdal::Reader(), m_index(0), m_istream(NULL) {} + virtual ~LasReader() + { destroyStream(); } + static void * create(); static int32_t destroy(void *); std::string getName() const; @@ -79,7 +81,7 @@ class PDAL_DLL LasReader : public pdal::Reader return m_istream; } virtual void destroyStream() - { FileUtils::closeFile(m_istream); } + { FileUtils::closeFile(m_istream); m_istream = NULL; } private: LasError m_error; LasHeader m_lasHeader; diff --git a/plugins/nitf/io/NitfReader.hpp b/plugins/nitf/io/NitfReader.hpp index ed5076578e..6a4cdfb06c 100644 --- a/plugins/nitf/io/NitfReader.hpp +++ b/plugins/nitf/io/NitfReader.hpp @@ -73,6 +73,7 @@ typedef boost::iostreams::stream RStream; m_rstream.reset(); m_rdevice.reset(); FileUtils::closeFile(m_istream); + m_istream = NULL; } private: diff --git a/plugins/oci/io/OciCommon.cpp b/plugins/oci/io/OciCommon.cpp index d6d140590c..c3cd236141 100644 --- a/plugins/oci/io/OciCommon.cpp +++ b/plugins/oci/io/OciCommon.cpp @@ -71,6 +71,8 @@ Connection connect(std::string connSpec) output = line; } connection = output; + + FileUtils::closeFile(input); } Connection con; diff --git a/plugins/oci/io/OciWriter.cpp b/plugins/oci/io/OciWriter.cpp index 057ecd1e41..60213416fa 100644 --- a/plugins/oci/io/OciWriter.cpp +++ b/plugins/oci/io/OciWriter.cpp @@ -423,6 +423,9 @@ std::string OciWriter::loadSQLData(std::string const& filename) else output = line; } + + FileUtils::closeFile(input); + return output; } @@ -715,7 +718,7 @@ void OciWriter::processOptions(const Options& options) if (m_compression && (m_orientation == Orientation::DimensionMajor)) throw pdal_error("LAZperf compression not supported for " - "dimension-major point storage."); + "dimension-major point storage."); } @@ -917,7 +920,7 @@ void OciWriter::writeTile(const PointViewPtr view) if (usePartition) oss << ", :9"; oss <<")"; - + Statement statement(m_connection->CreateStatement(oss.str().c_str())); // :1 @@ -940,7 +943,7 @@ void OciWriter::writeTile(const PointViewPtr view) //NOTE: packed point size is guaranteed to be of sufficient size to hold // a point's data, but it may be larger than the actual size of a point - // if location scaling is being used. + // if location scaling is being used. std::vector outbuf(packedPointSize() * view->size()); size_t totalSize = 0; if (m_orientation == Orientation::DimensionMajor)