diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-16 07:57:03 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-16 06:20:33 -0400 |
commit | 6fd663f9b39cd60c7381ab16c798f68530194f2b (patch) | |
tree | 35fef50823f4d9001f1de8757a654af21470c814 /core/dive.c | |
parent | 065c41b8347a4343d0f616542eadbb72f3d04bf1 (diff) | |
download | subsurface-6fd663f9b39cd60c7381ab16c798f68530194f2b.tar.gz |
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>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/core/dive.c b/core/dive.c index 0912f0388..08ef5b6bd 100644 --- a/core/dive.c +++ b/core/dive.c @@ -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 * 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; - free(dc->sample); - free((void *)dc->model); - free((void *)dc->serial); - free((void *)dc->fw_version); - free_events(dc->events); + free_dc_contents(dc); memcpy(dc, fdc, sizeof(struct divecomputer)); free(fdc); } else { |