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 <[email protected]> --- planner.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/planner.c b/planner.c index 026581d..b0da873 100644 --- a/planner.c +++ b/planner.c @@ -246,6 +246,7 @@ static void create_dive_from_plan(struct diveplan *diveplan) struct divecomputer *dc; struct sample *sample; struct gasmix oldgasmix; + struct event *ev; cylinder_t *cyl; int oldpo2 = 0; int lasttime = 0; @@ -261,6 +262,11 @@ 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; + printf("freeing ev: %s\n", ev->name); + free(ev); + } dc->sample = NULL; dc->samples = 0; dc->alloc_samples = 0; -- 1.9.1 _______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
