Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mismatched memory allocation and deallocation. #6923

Merged
merged 3 commits into from
Sep 19, 2024

Conversation

s-perron
Copy link
Collaborator

In NestedNameSpecifier.cpp, the Append function allocates data using new:

char *NewBuffer =
new char[NewCapacity]; // HLSL Change: Use overridable operator new

However, if it deallocated using free:

if (BufferCapacity) {
free(Buffer);
BufferCapacity = 0;

This can cause problems. I'm changing the free to delete.

@s-perron s-perron requested a review from a team as a code owner September 19, 2024 13:56
tools/clang/lib/AST/NestedNameSpecifier.cpp Outdated Show resolved Hide resolved
@s-perron s-perron enabled auto-merge (squash) September 19, 2024 18:03
@s-perron s-perron merged commit 26ea670 into microsoft:main Sep 19, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants