core: use free_dive() to free dive

One would think that calling free() on a dive structure, as the code
did in some places, would lead to a memory leak.

(Insert rant about C memory management.)

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-08-20 17:24:45 +02:00 committed by Dirk Hohndel
parent 252761498a
commit 1c00f9f233
5 changed files with 7 additions and 14 deletions

View file

@ -609,7 +609,7 @@ int parse_txt_file(const char *filename, const char *csv, struct dive_table *tab
*/
if (readfile(csv, &memcsv) < 0) {
free(dive);
free_dive(dive);
return report_error(translate("gettextFromC", "Poseidon import failed: unable to read '%s'"), csv);
}
lineptr = memcsv.buffer;