summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dive.c b/dive.c
index acab8ff52..139afe23e 100644
--- a/dive.c
+++ b/dive.c
@@ -70,8 +70,13 @@ void remove_event(struct event* event)
while (ep && !same_event(*ep, event))
ep = &(*ep)->next;
if (ep) {
- *ep = event->next;
- free(event);
+ /* we can't link directly with event->next
+ * because 'event' can be a copy from another
+ * dive (for instance the displayed_dive
+ * that we use on the interface to show things). */
+ struct event *temp = (*ep)->next;
+ free(*ep);
+ *ep = temp;
}
}