From fea8e96fe94b8260589a91a85213cd6ba355617a Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 29 May 2014 09:42:21 +0100 Subject: [PATCH] Fix for airport search on some platforms. Ensure the std::string passed to sqlite lives for the duration of the query. --- src/Navaids/NavDataCache.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index f34294e11..4c5a030ba 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -1750,13 +1750,13 @@ char** NavDataCache::searchAirportNamesAndIdents(const std::string& aFilter) { sqlite3_stmt_ptr stmt; unsigned int numMatches = 0, numAllocated = 16; + string searchTerm("%" + aFilter + "%"); if (aFilter.empty()) { stmt = d->getAllAirports; numAllocated = 4096; // start much larger for all airports } else { stmt = d->searchAirports; - string s = "%" + aFilter + "%"; - sqlite_bind_stdstring(stmt, 1, s); + sqlite_bind_stdstring(stmt, 1, searchTerm); } char** result = (char**) malloc(sizeof(char*) * numAllocated);