diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-15 13:00:28 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-15 12:50:44 -0400 |
commit | 207ca0f94e96fa9f903653295a5cac4691a8b45a (patch) | |
tree | 28a496f52c4baba3bbedc4365492bbcef4c0d844 /core/dive.c | |
parent | 471fc1dfc8c9801aeeb2fa154e13e42c05fc9285 (diff) | |
download | subsurface-207ca0f94e96fa9f903653295a5cac4691a8b45a.tar.gz |
Dive list: make deep copy of picture list on merge
On merging make a deep copy of the picture list, to avoid a use-after-free
crash after the orginal dive is deleted.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c index 5c3cd2393..0226cc2c1 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3475,7 +3475,7 @@ struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, MERGE_MAX(res, a, b, number); MERGE_NONZERO(res, a, b, cns); MERGE_NONZERO(res, a, b, visibility); - MERGE_NONZERO(res, a, b, picture_list); + STRUCTURED_LIST_COPY(struct picture, a->picture_list ? a->picture_list : b->picture_list, res->picture_list, copy_pl); taglist_merge(&res->tag_list, a->tag_list, b->tag_list); merge_cylinders(res, a, b, cylinders_map_a, cylinders_map_b); merge_equipment(res, a, b); |