From a5380bb741c1081c86353cf5cd7b506b97e02ea9 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 20 Jun 2018 09:20:32 +0900 Subject: core: add free_samples helper And use it in the UI and planner code. See #1411 Signed-off-by: Dirk Hohndel --- core/dive.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/dive.c') diff --git a/core/dive.c b/core/dive.c index bbfc5322d..3b3ad762d 100644 --- a/core/dive.c +++ b/core/dive.c @@ -754,6 +754,16 @@ void alloc_samples(struct divecomputer *dc, int num) } } +void free_samples(struct divecomputer *dc) +{ + if (dc) { + free(dc->sample); + dc->sample = 0; + dc->samples = 0; + dc->alloc_samples = 0; + } +} + struct sample *prepare_sample(struct divecomputer *dc) { if (dc) { -- cgit v1.2.3-70-g09d2