diff --git a/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h b/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h index 441775d696c9..2b691f85d7b0 100644 --- a/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h +++ b/Code/Mantid/Framework/Nexus/inc/MantidNexus/NexusFileIO.h @@ -9,6 +9,8 @@ #include #include #include +#include + #include #include @@ -391,7 +393,8 @@ namespace Mantid dims[1] = static_cast(maxSize); // Create data array - Type data[rowCount * maxSize]; + boost::scoped_array data(new Type[rowCount * maxSize]); + for ( size_t i = 0; i < rowCount; ++i ) { auto values = column->template cell< std::vector >(i); @@ -405,7 +408,7 @@ namespace Mantid } // Write data - NXwritedata(columnName.c_str(), nexusType, 2, dims, reinterpret_cast(&data), false); + NXwritedata(columnName.c_str(), nexusType, 2, dims, reinterpret_cast(data.get()), false); std::string units = "Not known"; std::string interpret_as = "A vector of " + typeName;