aboutsummaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/locationinformation.cpp')
-rw-r--r--desktop-widgets/locationinformation.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index 01a1a4390..780390198 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -317,10 +317,12 @@ void LocationInformationWidget::reverseGeocode()
location_t location = parseGpsText(ui.diveSiteCoordinates->text());
if (!ds || !has_location(&location))
return;
- taxonomy_data taxonomy = { 0, 0 };
- reverseGeoLookup(location.lat, location.lon, &taxonomy);
- if (ds != diveSite)
+ taxonomy_data taxonomy = reverseGeoLookup(location.lat, location.lon);
+ if (ds != diveSite) {
+ free_taxonomy(&taxonomy);
return;
+ }
+ // This call transfers ownership of the taxonomy memory into an EditDiveSiteTaxonomy object
Command::editDiveSiteTaxonomy(ds, taxonomy);
}