Skip to content

Commit 14dbc4a

Browse files
committed
Avoid access of list entry after erase, else it raise "cannot dereference value-initialized list iterator" error in DEBUG build.
1 parent 97178d0 commit 14dbc4a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/dsql/DsqlStatementCache.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ void DsqlStatementCache::removeStatement(thread_db* tdbb, DsqlStatement* stateme
164164
{
165165
const auto entry = *entryPtr;
166166

167+
map.remove(entry->key);
167168
entry->dsqlStatement->resetCacheKey();
168169

169170
if (entry->active)
@@ -173,11 +174,9 @@ void DsqlStatementCache::removeStatement(thread_db* tdbb, DsqlStatement* stateme
173174
}
174175
else
175176
{
176-
inactiveStatementList.erase(entry);
177177
cacheSize -= entry->size;
178+
inactiveStatementList.erase(entry);
178179
}
179-
180-
map.remove(entry->key);
181180
}
182181
}
183182
}

0 commit comments

Comments
 (0)