mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: accept NULL-pointer in free_trip() and free_divesite()
This is consistent with most other free_*() functions in the core code and will make cleanup of parser state less verbose. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
46bf8bf2fa
commit
343808271c
2 changed files with 12 additions and 8 deletions
|
@ -765,9 +765,11 @@ void insert_trip_dont_merge(dive_trip_t *dive_trip)
|
|||
/* free resources associated with a trip structure */
|
||||
void free_trip(dive_trip_t *trip)
|
||||
{
|
||||
free(trip->location);
|
||||
free(trip->notes);
|
||||
free(trip);
|
||||
if (trip) {
|
||||
free(trip->location);
|
||||
free(trip->notes);
|
||||
free(trip);
|
||||
}
|
||||
}
|
||||
|
||||
/* remove trip from the trip-list, but don't free its memory.
|
||||
|
|
|
@ -168,11 +168,13 @@ bool is_dive_site_used(uint32_t uuid, bool select_only)
|
|||
|
||||
void free_dive_site(struct dive_site *ds)
|
||||
{
|
||||
free(ds->name);
|
||||
free(ds->notes);
|
||||
free(ds->description);
|
||||
free_taxonomy(&ds->taxonomy);
|
||||
free(ds);
|
||||
if (ds) {
|
||||
free(ds->name);
|
||||
free(ds->notes);
|
||||
free(ds->description);
|
||||
free_taxonomy(&ds->taxonomy);
|
||||
free(ds);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_dive_site(uint32_t id)
|
||||
|
|
Loading…
Add table
Reference in a new issue