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>
This commit is contained in:
Berthold Stoeger 2021-03-05 22:00:31 +01:00 committed by Dirk Hohndel
parent d1c89a55e1
commit 5ba6db80cc

View file

@ -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;