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 -Werror=free-nonheap-object warning as error #2268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

djbn65
Copy link
Contributor

@djbn65 djbn65 commented Mar 21, 2024

When building the perftest, schematest.cpp was yielding an error in relation to freeing a stack object. This change fixes that by explicitly passing in nullptr to CrtAllocator::Free if we don't own the memory.

Fixes: #2267

When building the perftest, schematest.cpp was yielding an error in
relation to freeing a stack object. This change fixes that by explicitly
passing in nullptr to CrtAllocator::Free if we don't own the memory.

Change-Id: Ide53cc324af1ae3fef3d9096684e3aac0c1427ff
@djbn65
Copy link
Contributor Author

djbn65 commented Mar 22, 2024

std::free(nullptr)

is also safe and does not invoke undefined behavior as per the standard.

@djbn65
Copy link
Contributor Author

djbn65 commented Mar 22, 2024

@miloyip, @tencent-adm, this patch should be ready to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-Werror=free-nonheap-object in allocators.h line 271
1 participant