Skip to content

Commit

Permalink
Fix deleted memory use in optimizer (#242)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
XaBbl4 authored and dyemanov committed Dec 6, 2019
1 parent b85a307 commit fc67e18
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jrd/Optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ OptimizerRetrieval::~OptimizerRetrieval()
* Functional description
*
**************************************/

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

if (!invCandidate)
Expand Down

0 comments on commit fc67e18

Please sign in to comment.