Avoid duplicate dive_trip entries

When inserting a trip into the dive_trip_list we already check for
duplicate trips, but we still kept the additional dive_trip around.

With this change we instead replace it with the existing one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-09-05 13:54:22 -07:00
parent 6d0af91398
commit 4679f4fbbc
3 changed files with 8 additions and 11 deletions

View file

@ -921,7 +921,7 @@ static struct dive *create_and_hookup_trip_from_dive(struct dive *dive)
dive_trip->when = dive->when;
if (dive->location)
dive_trip->location = strdup(dive->location);
insert_trip(dive_trip);
insert_trip(&dive_trip);
dive->divetrip = dive_trip;
dive->tripflag = IN_TRIP;
return dive_trip;