mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
252761498a
commit
1c00f9f233
5 changed files with 7 additions and 14 deletions
|
@ -857,14 +857,7 @@ static bool uemis_delete_dive(device_data_t *devdata, uint32_t diveid)
|
|||
}
|
||||
if (dive) {
|
||||
devdata->download_table->dives[--devdata->download_table->nr] = NULL;
|
||||
|
||||
free(dive->dc.sample);
|
||||
free((void *)dive->notes);
|
||||
free((void *)dive->diveguide);
|
||||
free((void *)dive->buddy);
|
||||
free((void *)dive->suit);
|
||||
taglist_free(dive->tag_list);
|
||||
free(dive);
|
||||
free_dive(dive);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1030,7 +1023,7 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
|
|||
if (dive->dc.diveid) {
|
||||
record_dive_to_table(dive, devdata->download_table);
|
||||
} else { /* partial dive */
|
||||
free(dive);
|
||||
free_dive(dive);
|
||||
free(buf);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue