core: add free_samples helper

And use it in the UI and planner code.

See #1411

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-06-20 09:20:32 +09:00
parent 49f3da3bfd
commit a5380bb741
4 changed files with 16 additions and 15 deletions

View file

@ -284,10 +284,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
dc->when = dive->when = diveplan->when;
dc->surface_pressure.mbar = diveplan->surface_pressure;
dc->salinity = diveplan->salinity;
free(dc->sample);
dc->sample = NULL;
dc->samples = 0;
dc->alloc_samples = 0;
free_samples(dc);
while ((ev = dc->events)) {
dc->events = dc->events->next;
free(ev);