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 <[email protected]>
---
 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

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to