aboutsummaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-12-12 08:59:11 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-12-12 07:01:16 -0800
commit46bd71a18427b5cc650b26b4d77d9a1260b79941 (patch)
tree17fa36eb79ce9a36d5a8a121f463546394a4ec10 /dive.c
parente7698beea779be6a372f3194b63d6e94f878c7ae (diff)
downloadsubsurface-46bd71a18427b5cc650b26b4d77d9a1260b79941.tar.gz
Initialize alloc_samples in copy_samples
We rely on alloc_samples in prepare_sample. If alloc_samples weren't initialized prepare_sample would wreak havoc on the samples list. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index b318c4be1..7ec4bc918 100644
--- a/dive.c
+++ b/dive.c
@@ -601,6 +601,7 @@ void copy_samples(struct divecomputer *s, struct divecomputer *d)
return;
int nr = s->samples;
d->samples = nr;
+ d->alloc_samples = nr;
d->sample = malloc(nr * sizeof(struct sample));
if (d->sample)
memcpy(d->sample, s->sample, nr * sizeof(struct sample));