Skip to content

Commit 423ff84

Browse files
committed
fixed memory leaks
1 parent a4b9ccb commit 423ff84

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/MathFunctions_t.cpp

+3-12
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ TEST_CASE("CMathFunctions::calcWVMie::BH", "[MathFunctions][CMathFunctions]")
6767
dcomplex ri {1.55, 0.0};
6868
double x {PIx2 * 0.525 / 0.6328};
6969
double qext, qabs, qsca, gsca {};
70-
double* S11 = new double[nr_theta];
71-
double* S12 = new double[nr_theta];
72-
double* S33 = new double[nr_theta];
73-
double* S34 = new double[nr_theta];
70+
double S11[nr_theta], S12[nr_theta], S33[nr_theta], S34[nr_theta];
7471

7572
dlist theta(nr_theta);
7673
for(uint th = 0; th < nr_theta; th++) {
@@ -121,10 +118,7 @@ TEST_CASE("CMathFunctions::calcWVMie::W1", "[MathFunctions][CMathFunctions]")
121118
dcomplex ri {1.5, 0.0};
122119
auto x = GENERATE(10.0, 100.0, 1000.0, 5000.0);
123120
double qext, qabs, qsca, gsca {};
124-
double *S11 = new double[nr_theta];
125-
double *S12 = new double[nr_theta];
126-
double *S33 = new double[nr_theta];
127-
double *S34 = new double[nr_theta];
121+
double S11[nr_theta], S12[nr_theta], S33[nr_theta], S34[nr_theta];
128122

129123
dlist theta(nr_theta);
130124
for(uint th = 0; th < nr_theta; th++) {
@@ -232,10 +226,7 @@ TEST_CASE("CMathFunctions::calcWVMie::W2", "[MathFunctions][CMathFunctions]")
232226
dcomplex ri {1.5, 0.1};
233227
auto x = GENERATE(10.0, 100.0, 1000.0, 5000.0);
234228
double qext, qabs, qsca, gsca {};
235-
double *S11 = new double[nr_theta];
236-
double *S12 = new double[nr_theta];
237-
double *S33 = new double[nr_theta];
238-
double *S34 = new double[nr_theta];
229+
double S11[nr_theta], S12[nr_theta], S33[nr_theta], S34[nr_theta];
239230

240231
dlist theta(nr_theta);
241232
for(uint th = 0; th < nr_theta; th++) {

src/Pipeline.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ pos_1.normalized();
16101610
cell_1->updateData(data_off + 1, -F1.Y());
16111611
cell_1->updateData(data_off + 2, -F1.Z());
16121612
1613-
/*for(long c_2 = c_1 + 1; c_2 < long(max_cells - 1); c_2++)
1613+
for(long c_2 = c_1 + 1; c_2 < long(max_cells - 1); c_2++)
16141614
{
16151615
cell_oc * cell_2 = (cell_oc*) grid->getCellFromIndex(c_2);
16161616
double dens_2 = grid->getGasNumberDensity(cell_2);

0 commit comments

Comments
 (0)