suunto import: give and free error message

There was a memory leak in the error case of sqlite3_exec():
The error message was not freed (and also not displayed).

Display and free it. Is there a reasonable C++ version of this
library?

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-08-13 22:19:20 +02:00 committed by Michael Keller
parent 152e6966c9
commit df568fbb5d

View file

@ -293,7 +293,8 @@ int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *, int, struct
retval = sqlite3_exec(handle, get_dives, &dm4_dive, &state, &err);
if (retval != SQLITE_OK) {
report_info("Database query failed '%s'.", url);
report_info("Database query failed '%s': %s.", url, err);
sqlite3_free(err);
return 1;
}
@ -564,7 +565,8 @@ int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *, int, struct
retval = sqlite3_exec(handle, get_dives, &dm5_dive, &state, &err);
if (retval != SQLITE_OK) {
report_info("Database query failed '%s'.", url);
report_info("Database query failed '%s': %s.", url, err);
sqlite3_free(err);
return 1;
}