From 46bd71a18427b5cc650b26b4d77d9a1260b79941 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Fri, 12 Dec 2014 08:59:11 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- dive.c | 1 + 1 file changed, 1 insertion(+) 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)); -- cgit v1.2.3-70-g09d2