mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
e7698beea7
commit
46bd71a184
1 changed files with 1 additions and 0 deletions
1
dive.c
1
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));
|
||||
|
|
Loading…
Add table
Reference in a new issue