mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:13:24 +00:00
core: use num in alloc_samples
When num > dc->alloc_samples we whould allocate space for num Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
44a9b26889
commit
cabc5859fd
1 changed files with 1 additions and 1 deletions
|
@ -747,7 +747,7 @@ void copy_samples(struct divecomputer *s, struct divecomputer *d)
|
|||
void alloc_samples(struct divecomputer *dc, int num)
|
||||
{
|
||||
if (num > dc->alloc_samples) {
|
||||
dc->alloc_samples = (dc->alloc_samples * 3) / 2 + 10;
|
||||
dc->alloc_samples = (num * 3) / 2 + 10;
|
||||
dc->sample = realloc(dc->sample, dc->alloc_samples * sizeof(struct sample));
|
||||
if (!dc->sample)
|
||||
dc->samples = dc->alloc_samples = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue