Skip to content

Commit

Permalink
Merge pull request #100 from r9y9/harvest-memory-fixes
Browse files Browse the repository at this point in the history
Harvest: two memory fixes that may have caused undefined behavior or segfaults
  • Loading branch information
mmorise committed Jun 15, 2020
2 parents 9721584 + 0f39268 commit ac2784d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/harvest.cpp
Expand Up @@ -674,7 +674,7 @@ static void RemoveUnreliableCandidates(int f0_length, int number_of_candidates,
double **tmp_f0_candidates = new double *[f0_length];
for (int i = 0; i < f0_length; ++i)
tmp_f0_candidates[i] = new double[number_of_candidates];
for (int i = 1; i < f0_length - 1; ++i)
for (int i = 0; i < f0_length; ++i)
for (int j = 0; j < number_of_candidates; ++j)
tmp_f0_candidates[i][j] = f0_candidates[i][j];

Expand Down Expand Up @@ -709,7 +709,7 @@ static void SearchF0Base(const double * const *f0_candidates,
//-----------------------------------------------------------------------------
static void FixStep1(const double *f0_base, int f0_length,
double allowed_range, double *f0_step1) {
f0_step1[0] = f0_step1[1] = 0.0;
for (int i = 0; i < f0_length; ++i) f0_step1[i] = 0.0;
double reference_f0;
for (int i = 2; i < f0_length; ++i) {
if (f0_base[i] == 0.0) continue;
Expand Down

0 comments on commit ac2784d

Please sign in to comment.