From 207ca0f94e96fa9f903653295a5cac4691a8b45a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 15 Oct 2018 13:00:28 +0200 Subject: 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 --- core/dive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/dive.c') 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); -- cgit v1.2.3-70-g09d2