diff --git a/commands/command_divelist.cpp b/commands/command_divelist.cpp index b6901c523..6ca13f5f9 100644 --- a/commands/command_divelist.cpp +++ b/commands/command_divelist.cpp @@ -521,6 +521,11 @@ ImportDives::ImportDives(struct divelog *log, int flags, const QString &source) continue; filterPresetsToAdd.emplace_back(preset.name, preset.data); } + + free(dives_to_add.dives); + free(dives_to_remove.dives); + free(trips_to_add.trips); + free(sites_to_add.dive_sites); } bool ImportDives::workToBeDone() diff --git a/core/divelist.c b/core/divelist.c index 8c677498a..c6d1a7e31 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -1007,6 +1007,10 @@ void add_imported_dives(struct divelog *import_log, int flags) current_dive = divelog.dives->nr > 0 ? divelog.dives->dives[divelog.dives->nr - 1] : NULL; free_device_table(devices_to_add); + free(dives_to_add.dives); + free(dives_to_remove.dives); + free(trips_to_add.trips); + free(dive_sites_to_add.dive_sites); /* Inform frontend of reset data. This should reset all the models. */ emit_reset_signal();