Commit 62c6eed3 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'memory_leak' into 'master'

Free the offsets array at the end of the particle sorting routines.

See merge request swift/swiftsim!538
parents 11e6cffa 4185377c
......@@ -1420,7 +1420,9 @@ void space_parts_sort(struct part *parts, struct xpart *xparts, int *ind,
for (int k = 0; k < num_bins; k++)
if (offsets[k + 1] != offsets[k] + counts[k])
error("Bad offsets after shuffle.");
#endif // SWIFT_DEBUG_CHECKS
#endif /* SWIFT_DEBUG_CHECKS */
free(offsets);
}
/**
......@@ -1475,7 +1477,9 @@ void space_sparts_sort(struct spart *sparts, int *ind, int *counts,
for (int k = 0; k < num_bins; k++)
if (offsets[k + 1] != offsets[k] + counts[k])
error("Bad offsets after shuffle.");
#endif // SWIFT_DEBUG_CHECKS
#endif /* SWIFT_DEBUG_CHECKS */
free(offsets);
}
/**
......@@ -1537,7 +1541,9 @@ void space_gparts_sort(struct gpart *gparts, struct part *parts,
for (int k = 0; k < num_bins; k++)
if (offsets[k + 1] != offsets[k] + counts[k])
error("Bad offsets after shuffle.");
#endif // SWIFT_DEBUG_CHECKS
#endif /* SWIFT_DEBUG_CHECKS */
free(offsets);
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment