Skip to content

Commit

Permalink
Merge pull request #322 from Pentalimbed/dev-jack
Browse files Browse the repository at this point in the history
fix: prevent memory leak from `GetFeatureBufferData`
  • Loading branch information
doodlum committed Jul 3, 2024
2 parents f2faae4 + 2826b52 commit 770ef35
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,10 @@ void State::SetupResources()

permutationCB = new ConstantBuffer(ConstantBufferDesc<PermutationCB>());
sharedDataCB = new ConstantBuffer(ConstantBufferDesc<SharedDataCB>());
auto [_, size] = GetFeatureBufferData();

auto [data, size] = GetFeatureBufferData();
featureDataCB = new ConstantBuffer(ConstantBufferDesc((uint32_t)size));
delete[] data;

// Grab main texture to get resolution
// VR cannot use viewport->screenWidth/Height as it's the desktop preview window's resolution and not HMD
Expand Down

0 comments on commit 770ef35

Please sign in to comment.