summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-06-19 20:27:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-20 07:59:07 +0900
commitcabc5859fdeeac3f2f23299c442baf4f33245991 (patch)
treedc8a8d02b85e950ca1ebfa6a77842b73a8b4c000 /core/dive.c
parent44a9b26889850d3fd33e0f04ab39f8a4f827ba32 (diff)
downloadsubsurface-cabc5859fdeeac3f2f23299c442baf4f33245991.tar.gz
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>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c
index 38994aab4..bbfc5322d 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -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;