mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: use free_dc_contents() in delete_current_divecomputer()
delete_current_divecomputer() had some duplicate code to release dive-computer resources. Use the free_dc_contents() function instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
065c41b834
commit
6fd663f9b3
1 changed files with 1 additions and 5 deletions
|
@ -4157,11 +4157,7 @@ void delete_current_divecomputer(void)
|
||||||
/* remove the first one, so copy the second one in place of the first and free the second one
|
/* remove the first one, so copy the second one in place of the first and free the second one
|
||||||
* be careful about freeing the no longer needed structures - since we copy things around we can't use free_dc()*/
|
* be careful about freeing the no longer needed structures - since we copy things around we can't use free_dc()*/
|
||||||
struct divecomputer *fdc = dc->next;
|
struct divecomputer *fdc = dc->next;
|
||||||
free(dc->sample);
|
free_dc_contents(dc);
|
||||||
free((void *)dc->model);
|
|
||||||
free((void *)dc->serial);
|
|
||||||
free((void *)dc->fw_version);
|
|
||||||
free_events(dc->events);
|
|
||||||
memcpy(dc, fdc, sizeof(struct divecomputer));
|
memcpy(dc, fdc, sizeof(struct divecomputer));
|
||||||
free(fdc);
|
free(fdc);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue