8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

Fix deleted memory use in optimizer (#242)

In function gen_retrieval (jrd/opt.cpp) created OptimizerRetrieval and
call getInversion, where created InversionCandidateList and after
analyzeNavigation variable navigationCandidate linked to item of list.
After clean up the list in function gen_retrieval call getNavigation
where using variable navigationCandidate.
This commit is contained in:
Andrey Kravchenko 2019-12-06 10:18:42 +03:00 committed by Dmitry Yemanov
parent 21f2b8c5ed
commit 913b9499e9

View File

@ -384,7 +384,8 @@ OptimizerRetrieval::~OptimizerRetrieval()
* Functional description * Functional description
* *
**************************************/ **************************************/
if (navigationCandidate)
delete navigationCandidate;
for (FB_SIZE_T i = 0; i < inversionCandidates.getCount(); ++i) for (FB_SIZE_T i = 0; i < inversionCandidates.getCount(); ++i)
delete inversionCandidates[i]; delete inversionCandidates[i];
} }
@ -522,7 +523,8 @@ InversionCandidate* OptimizerRetrieval::generateInversion()
// Clean up inversion list // Clean up inversion list
InversionCandidate** inversion = inversions.begin(); InversionCandidate** inversion = inversions.begin();
for (FB_SIZE_T i = 0; i < inversions.getCount(); i++) for (FB_SIZE_T i = 0; i < inversions.getCount(); i++)
delete inversion[i]; if (inversion[i] != navigationCandidate)
delete inversion[i];
} }
if (!invCandidate) if (!invCandidate)