summaryrefslogtreecommitdiffstats
path: root/smtk-import/smartrak.c
diff options
context:
space:
mode:
authorGravatar Salvador Cuñat <salvador.cunat@gmail.com>2017-04-12 21:54:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-04-21 06:52:13 -0700
commit75007aa4ef7b99064678ff92ec9819e76f553cfb (patch)
tree3915f7489d5bd093baa55c8c8534eb15ff0c3124 /smtk-import/smartrak.c
parent329a6bc0753260f3d0184448155a8ef6844d9b43 (diff)
downloadsubsurface-75007aa4ef7b99064678ff92ec9819e76f553cfb.tar.gz
smtk-import reuse pre-existent code and fix leak
Use update_event_name() for bookmarks merge and free temp string. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Diffstat (limited to 'smtk-import/smartrak.c')
-rw-r--r--smtk-import/smartrak.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c
index ba38c6b33..a50186b3d 100644
--- a/smtk-import/smartrak.c
+++ b/smtk-import/smartrak.c
@@ -687,15 +687,15 @@ static void smtk_parse_bookmarks(MdbHandle *mdb, struct dive *d, char *dive_idx)
time = lrint(strtod(col[4]->bind_ptr, NULL) * 60);
tmp = strdup(col[2]->bind_ptr);
ev = find_bookmark(d->dc.events, time);
- if (ev != NULL) {
- memset(&ev->name, 0, strlen(tmp) + 1);
- memcpy(ev->name, tmp, strlen(tmp));
- } else
+ if (ev)
+ update_event_name(d, ev, tmp);
+ else
if (!add_event(&d->dc, time, SAMPLE_EVENT_BOOKMARK, 0, 0, tmp))
report_error("[smtk-import] Error - Couldn't add bookmark, dive %d, Name = %s",
d->number, tmp);
}
}
+ free(tmp);
smtk_free(bound_values, table->num_cols);
mdb_free_tabledef(table);
}