diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-21 21:48:47 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-10-23 08:06:17 +0100 |
commit | 343808271c22942992f4470c05e138d8597a630b (patch) | |
tree | 61df6531dc70c03fee2bfc03e1e806f896822e50 /core/divesite.c | |
parent | 46bf8bf2fa37f1aae44241a5f7d846810041aac9 (diff) | |
download | subsurface-343808271c22942992f4470c05e138d8597a630b.tar.gz |
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>
Diffstat (limited to 'core/divesite.c')
-rw-r--r-- | core/divesite.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/divesite.c b/core/divesite.c index ea9a3ed58..ee394d9d1 100644 --- a/core/divesite.c +++ b/core/divesite.c @@ -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) |