summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-15 21:58:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-15 21:00:45 -0400
commit763c3683e58684f296d6b66835ca6d84e14b3900 (patch)
tree1e87a5ffb7843acc02a821fd35da3f935bbb138a
parent7f49e43d767211a654d26240b5a33397153265ef (diff)
downloadsubsurface-763c3683e58684f296d6b66835ca6d84e14b3900.tar.gz
Core: fix broken commit e5dca8228e
In commit e5dca8228e6b60cac5957726700c66d0565c064e a fixed order of the arguments to merge_dives() was introduced: first dive old, second dive downloaded. This made the dl variable, which pointed to the downloaded dive useless. One instance was forgotten, which led to a null-dereference. Remove. Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/dive.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/dive.c b/core/dive.c
index 1fe3eccf4..345b59c2c 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3438,7 +3438,6 @@ int count_dives_with_suit(const char *suit)
struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip)
{
struct dive *res = alloc_dive();
- const struct dive *dl = NULL;
const struct dive *preferred_trip;
int cylinders_map_a[MAX_CYLINDERS], cylinders_map_b[MAX_CYLINDERS];
@@ -3480,7 +3479,7 @@ struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset,
merge_temperatures(res, a, b);
if (prefer_downloaded) {
/* If we prefer downloaded, do those first, and get rid of "might be same" computers */
- join_dive_computers(res, &res->dc, &dl->dc, &a->dc, cylinders_map_b, cylinders_map_a, 1);
+ join_dive_computers(res, &res->dc, &b->dc, &a->dc, cylinders_map_b, cylinders_map_a, 1);
} else if (offset && might_be_same_device(&a->dc, &b->dc))
interleave_dive_computers(res, &res->dc, &a->dc, &b->dc, cylinders_map_a, cylinders_map_b, offset);
else