diff options
Diffstat (limited to 'core/divelist.c')
-rw-r--r-- | core/divelist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/divelist.c b/core/divelist.c index 0722953ae..88cf5645d 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -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. |