diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index 7c6a44c16e..c02f65e9b4 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -2412,10 +2412,9 @@ void write_nc(GenCTCInfo &gci) { unixtime valid_end = (unixtime) 0; // Allocate memory - float *data = (float *) nullptr; int nx = gci.NcOutGrid->nx(); int ny = gci.NcOutGrid->ny(); - data = new float [nx*ny]; + vector data(nx*ny, 0.0); // Loop over vector of output types for(i=0; i " << "error writing NetCDF variable name " << var_name << "\n\n"; @@ -2543,9 +2539,6 @@ void write_nc(GenCTCInfo &gci) { } } - // Deallocate and clean up - if(data) { delete [] data; data = (float *) nullptr; } - return; }