Skip to content

Commit

Permalink
removed if condition for G_free()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham Vasudeo Desai committed Nov 20, 2024
1 parent 69b732e commit 15dab4c
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions imagery/i.pca/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static int calc_mu_cov(int *fds, double **covar, double *mu, double *stddev,

if (count < 2) {
ret = 0;
goto cleanup;
goto free_exit;
}

for (i = 0; i < bands; i++) {
Expand All @@ -385,19 +385,15 @@ static int calc_mu_cov(int *fds, double **covar, double *mu, double *stddev,
for (i = 0; i < bands; i++)
mu[i] = sum[i] / count;

cleanup:
free_exit:
for (i = 0; i < bands; i++) {
if (sum2[i])
G_free(sum2[i]);
if (rowbuf[i])
G_free(rowbuf[i]);
G_free(sum2[i]);
G_free(rowbuf[i]);
}
G_free(rowbuf);
G_free(sum2);
if (sd)
G_free(sd);
if (sumsq)
G_free(sumsq);
G_free(sd);
G_free(sumsq);

return ret;
}
Expand Down

0 comments on commit 15dab4c

Please sign in to comment.