summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parse-xml.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/parse-xml.c b/parse-xml.c
index f82338b8a..2e4dbc560 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1096,10 +1096,13 @@ static struct divecomputer *get_dc(void)
static void event_end(void)
{
struct divecomputer *dc = get_dc();
- if (cur_event.name && strcmp(cur_event.name, "surface") != 0)
- add_event(dc, cur_event.time.seconds,
- cur_event.type, cur_event.flags,
- cur_event.value, cur_event.name);
+ if (cur_event.name) {
+ if (strcmp(cur_event.name, "surface") != 0)
+ add_event(dc, cur_event.time.seconds,
+ cur_event.type, cur_event.flags,
+ cur_event.value, cur_event.name);
+ free((void *)cur_event.name);
+ }
cur_event.active = 0;
}