diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2019-10-26 15:16:02 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-10-26 19:17:53 -0700 |
commit | cc2269b9c5236b60b6a9c86588285f0a78836b77 (patch) | |
tree | 5b6964653454c5edc55da8eaf16bd51a988299bc /core | |
parent | 30566135aa8b9fa75b071a2b23927db33aea63b5 (diff) | |
download | subsurface-cc2269b9c5236b60b6a9c86588285f0a78836b77.tar.gz |
Cleanup: don't add invalid dive to trip
Even if there is a valid trip, we should not add a structure that isn't
a dive to it.
Found by Coverity. Fixes CID #350073
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/parse.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/parse.c b/core/parse.c index 6205c5afa..8344d3552 100644 --- a/core/parse.c +++ b/core/parse.c @@ -246,12 +246,13 @@ void dive_end(struct parser_state *state) { if (!state->cur_dive) return; - if (!is_dive(state)) + if (!is_dive(state)) { free_dive(state->cur_dive); - else + } else { record_dive_to_table(state->cur_dive, state->target_table); - if (state->cur_trip) - add_dive_to_trip(state->cur_dive, state->cur_trip); + if (state->cur_trip) + add_dive_to_trip(state->cur_dive, state->cur_trip); + } state->cur_dive = NULL; state->cur_dc = NULL; state->cur_location.lat.udeg = 0; |