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

@ -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) {