Skip to content

Commit

Permalink
fix wrong localuse frees
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Dec 11, 2023
1 parent 51ad21d commit 862b739
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/dcd/server/autocomplete/localuse.d
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request,
auto sortedTokens = assumeSorted(tokenArray);
ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray,
&rba, request.cursorPosition, moduleCache);
scope(exit) pair.destroy();

SymbolStuff getSymbolsAtCursor(size_t cursorPosition)
{
Expand All @@ -71,7 +72,6 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request,

// gets the symbol matching to cursor pos
SymbolStuff stuff = getSymbolsAtCursor(cast(size_t)request.cursorPosition);
scope(exit) stuff.destroy();

// starts searching only if no ambiguity with the symbol
if (stuff.symbols.length == 1)
Expand Down Expand Up @@ -101,7 +101,6 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request,
{
size_t pos = cast(size_t) t.index + 1; // place cursor inside the token
SymbolStuff candidate = getSymbolsAtCursor(pos);
scope(exit) candidate.destroy();
if (candidate.symbols.length == 1 &&
candidate.symbols[0].location == sourceSymbol.location &&
candidate.symbols[0].symbolFile == sourceSymbol.symbolFile)
Expand Down

0 comments on commit 862b739

Please sign in to comment.