[PATCH 1/2] Initialize alloc_samples in copy_samples
Anton Lundin
glance at acc.umu.se
Thu Dec 11 23:59:11 PST 2014
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 at acc.umu.se>
---
dive.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dive.c b/dive.c
index bb92818..8e8330f 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));
--
2.1.0
More information about the subsurface
mailing list