mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Parser: fix leakage of dive-site and dive data
Dive site data was collected in "cur_dive_site", which was then merged into an existing or a new dive site. But only the struct dive_site pointed to by "cur_dive_site" and the taxonomy data were freed, not the textual data such as name or description. Therefore, split out the approrpriate free-ing from the delete_dive_site() function and call that instead of a simple free(). A similar situation occured for dives that would not be added to the dive-table because they were deemed incomplete. Use free_dive() here instead of a simple free() too. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a2028cd6ef
commit
08827cc5f6
3 changed files with 13 additions and 8 deletions
|
@ -228,8 +228,7 @@ void dive_site_end(void)
|
|||
if (verbose > 3)
|
||||
printf("completed dive site uuid %x8 name {%s}\n", ds->uuid, ds->name);
|
||||
}
|
||||
free_taxonomy(&cur_dive_site->taxonomy);
|
||||
free(cur_dive_site);
|
||||
free_dive_site(cur_dive_site);
|
||||
cur_dive_site = NULL;
|
||||
}
|
||||
|
||||
|
@ -254,7 +253,7 @@ void dive_end(void)
|
|||
if (!cur_dive)
|
||||
return;
|
||||
if (!is_dive())
|
||||
free(cur_dive);
|
||||
free_dive(cur_dive);
|
||||
else
|
||||
record_dive_to_table(cur_dive, target_table);
|
||||
cur_dive = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue