summaryrefslogtreecommitdiffstats
path: root/uemis-downloader.c
diff options
context:
space:
mode:
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r--uemis-downloader.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index 20a01e527..986aeb5b3 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -644,12 +644,12 @@ static void parse_divespot(char *buf)
uemis_set_divelocation(divespot, locationstring, longitude, latitude);
}
-static void track_divespot(char *val, int diveid, char **location, degrees_t *latitude, degrees_t *longitude)
+static void track_divespot(char *val, int diveid, uint32_t dive_site_uuid)
{
int id = atoi(val);
if (id >= 0 && id > nr_divespots)
nr_divespots = id;
- uemis_mark_divelocation(diveid, id, location, latitude, longitude);
+ uemis_mark_divelocation(diveid, id, dive_site_uuid);
return;
}
@@ -748,6 +748,7 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
fprintf(debugfile, "p_r_b entry deleted\n");
#endif
/* oops, this one isn't valid, suggest to try the previous one */
+ free(buf);
return false;
}
}
@@ -789,7 +790,8 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
if (for_dive)
*for_dive = atoi(val);
} else if (!log && dive && !strcmp(tag, "divespot_id")) {
- track_divespot(val, dive->dc.diveid, &dive->location, &dive->latitude, &dive->longitude);
+ dive->dive_site_uuid = create_dive_site("from Uemis");
+ track_divespot(val, dive->dc.diveid, dive->dive_site_uuid);
} else if (dive) {
parse_tag(dive, tag, val);
}
@@ -865,8 +867,10 @@ const char *do_uemis_import(device_data_t *data)
if (dive_table.nr == 0)
keep_number = true;
uemis_info(translate("gettextFromC", "Initialise communication"));
- if (!uemis_init(mountpath))
+ if (!uemis_init(mountpath)) {
+ free(reqtxt_path);
return translate("gettextFromC", "Uemis init failed");
+ }
if (!uemis_get_answer(mountpath, "getDeviceId", 0, 1, &result))
goto bail;
deviceid = strdup(param_buff[0]);
@@ -1001,5 +1005,6 @@ bail:
result = param_buff[2];
}
free(deviceid);
+ free(reqtxt_path);
return result;
}