1
0
Fork 0

Fix for airport search on some platforms.

Ensure the std::string passed to sqlite lives for the duration
of the query.
This commit is contained in:
James Turner 2014-05-29 09:42:21 +01:00
parent fd248e9391
commit fea8e96fe9

View file

@ -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);