[PATCH v2] Clear out old events in create_dive_from_plan
Anton Lundin
glance at acc.umu.se
Fri Jul 4 11:25:21 PDT 2014
Previous code where accumulating events from each iteration of the
planning. This code clears the old ones before adding new ones.
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
planner.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/planner.c b/planner.c
index 9196e3f..711dfa1 100644
--- a/planner.c
+++ b/planner.c
@@ -263,6 +263,10 @@ static void create_dive_from_plan(struct diveplan *diveplan)
reset_cylinders(&displayed_dive);
dc = &displayed_dive.dc;
free(dc->sample);
+ while (ev = dc->events) {
+ dc->events = dc->events->next;
+ free(ev);
+ }
dc->sample = NULL;
dc->samples = 0;
dc->alloc_samples = 0;
--
1.9.1
More information about the subsurface
mailing list