diff options
Diffstat (limited to 'src/fortune')
-rw-r--r-- | src/fortune/main.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fortune/main.c b/src/fortune/main.c index 543f6e4..a1a4372 100644 --- a/src/fortune/main.c +++ b/src/fortune/main.c @@ -95,8 +95,8 @@ intptr_t *run_voronoi(unsigned int num, double *lattice, bool periodic, double x double *eff_lattice = lattice; if (periodic) { - unsigned int eff_num = 9 * num; - double *eff_lattice = (double *)malloc(2 * eff_num * sizeof(double)); + eff_num = 9 * num; + eff_lattice = (double *)malloc(2 * eff_num * sizeof(double)); for (unsigned int i = 0; i < num; i++) { // original sites - our baby boys @@ -139,7 +139,7 @@ intptr_t *run_voronoi(unsigned int num, double *lattice, bool periodic, double x nsites = eff_num; readsites(eff_lattice); - free(eff_lattice); + if (periodic) free(eff_lattice); next = nextone; siteidx = 0; |