diff --git a/arangod/Indexes/GeoIndex.cpp b/arangod/Indexes/GeoIndex.cpp index 0d605f9a02..09ef14a8f0 100644 --- a/arangod/Indexes/GeoIndex.cpp +++ b/arangod/Indexes/GeoIndex.cpp @@ -106,13 +106,13 @@ void GeoIndexIterator::nextBabies(std::vector& result, size_t result.clear(); if (batchSize > 0) { auto coords = std::unique_ptr(::GeoIndex_ReadCursor(_cursor,batchSize)); + size_t length = coords ? coords->length : 0; //LOG_TOPIC(DEBUG, Logger::DEVEL) << "length " << length; - if (!length){ + if (!length) { return; } - for(std::size_t index = 0; index < length; ++index){ //LOG_TOPIC(DEBUG, Logger::DEVEL) << "near " << _near << " max allowed range: " << _withinRange // << " actual range: " << GeoIndex_distance(&_coor, &coords->coordinates[index]) ; diff --git a/arangod/Indexes/GeoIndex.h b/arangod/Indexes/GeoIndex.h index ca0195d7cd..0fdba7f795 100644 --- a/arangod/Indexes/GeoIndex.h +++ b/arangod/Indexes/GeoIndex.h @@ -180,4 +180,16 @@ friend class GeoIndexIterator; }; } +namespace std { +template <> +class default_delete { + public: + void operator()(GeoCoordinates* result) { + if (result != nullptr) { + GeoIndex_CoordinatesFree(result); + } + } +}; +} + #endif