From 720fc03f1baace063bc73320846576af6d7bcac4 Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Wed, 29 Aug 2012 10:57:13 -0400 Subject: [PATCH] fixed uninitialized values in spider and tif io --- modules/io/src/img/map_io_spi_handler.cc | 5 ++--- modules/io/src/img/map_io_tiff_handler.cc | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/io/src/img/map_io_spi_handler.cc b/modules/io/src/img/map_io_spi_handler.cc index feb9cb2a2..ad261daf9 100644 --- a/modules/io/src/img/map_io_spi_handler.cc +++ b/modules/io/src/img/map_io_spi_handler.cc @@ -390,9 +390,8 @@ template <typename B > void real_dumper(std::ostream& f, const spider_header& header, const img::ImageHandle& mh,const img::alg::Normalizer& norm, bool swap_flag) { int padding = header.fLabbyt-f.tellp(); - char* buffer=new char[padding]; - f.write(buffer,padding); - delete[] buffer; + std::vector<char> buffer(padding,0); + f.write(&buffer[0],padding); int slice_size=static_cast<int>(header.fNcol) * static_cast<int>(header.fNrow); boost::scoped_array<B> rawp(new B[slice_size]); diff --git a/modules/io/src/img/map_io_tiff_handler.cc b/modules/io/src/img/map_io_tiff_handler.cc index 0f418bc89..e6144315b 100644 --- a/modules/io/src/img/map_io_tiff_handler.cc +++ b/modules/io/src/img/map_io_tiff_handler.cc @@ -51,7 +51,8 @@ String TIF::FORMAT_STRING="defined_tiff"; normalize_on_save_(normalize_on_save), bit_depth_(bit_depth), signed_(sign), - phasecolor_(phasecolor) + phasecolor_(phasecolor), + subimage_(subimage) { } @@ -60,7 +61,8 @@ TIF::TIF(String format_string, boost::logic::tribool normalize_on_save, Format normalize_on_save_(normalize_on_save), bit_depth_(bit_depth), signed_(sign), - phasecolor_(phasecolor) + phasecolor_(phasecolor), + subimage_(subimage) { } -- GitLab