aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-03-05 22:00:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-03-08 16:29:04 -0800
commit5ba6db80cc67c2e74f572acf1e455551c024b1f8 (patch)
tree8ac9ea68c1e15febcaaff91608e87a225d594bbb
parentd1c89a55e146b3aee677cbaa96dda6dea485457c (diff)
downloadsubsurface-5ba6db80cc67c2e74f572acf1e455551c024b1f8.tar.gz
parser: initialize picture variable
When parsing "event 123" (?) a picture is added, without initializing the picture structure. Thus, a picture with a random gps location is added. Use the "empty_picture" initializer to avoid that. Fixes a Coverity warning. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/parse.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/parse.c b/core/parse.c
index d2be71e21..459108a26 100644
--- a/core/parse.c
+++ b/core/parse.c
@@ -114,7 +114,7 @@ void event_end(struct parser_state *state)
{
struct divecomputer *dc = get_dc(state);
if (state->cur_event.type == 123) {
- struct picture pic;
+ struct picture pic = empty_picture;
pic.filename = strdup(state->cur_event.name);
/* theoretically this could fail - but we didn't support multi year offsets */
pic.offset.seconds = state->cur_event.time.seconds;