summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-20 09:20:32 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-20 09:27:11 +0900
commita5380bb741c1081c86353cf5cd7b506b97e02ea9 (patch)
tree7766fa0dd4c359d07d9de95631bc052c5c082e5d /core/dive.c
parent49f3da3bfd9f336108fd5d4c3977b41e90f75d3f (diff)
downloadsubsurface-a5380bb741c1081c86353cf5cd7b506b97e02ea9.tar.gz
core: add free_samples helper
And use it in the UI and planner code. See #1411 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c10
1 files changed, 10 insertions, 0 deletions
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) {