Skip to content

Don't deallocate nullptr in _Hash_vec::_Tidy - #2790

Merged
Stephan T. Lavavej (StephanTLavavej) merged 2 commits into
microsoft:mainfrom
CaseyCarter:_Tidy
Jun 16, 2022
Merged

Stephan T. Lavavej (StephanTLavavej) merged 2 commits into
microsoft:mainfrom
CaseyCarter:_Tidy

Conversation

@CaseyCarter

Copy link
Copy Markdown
Contributor

... since we probably didn't get nullptr from an allocator, and user-defined allocators aren't required to tolerate dellocating nullptr.

Fixes #2789.

@CaseyCarter Casey Carter (CaseyCarter) added the bug Something isn't working label Jun 13, 2022
@CaseyCarter
Casey Carter (CaseyCarter) requested a review from a team as a code owner June 13, 2022 23:44
Comment thread tests/std/tests/GH_002789_Hash_vec_Tidy/test.cpp
Comment thread tests/std/tests/GH_002789_Hash_vec_Tidy/test.cpp
Comment thread tests/std/tests/GH_002789_Hash_vec_Tidy/test.cpp Outdated
... since we probably didn't get `nullptr` from an allocator, and user-defined allocators aren't required to tolerate dellocating `nullptr`.

Fixes microsoft#2789.
Comment thread tests/std/tests/GH_002789_Hash_vec_Tidy/test.cpp Outdated
Comment thread tests/std/tests/GH_002789_Hash_vec_Tidy/test.cpp Outdated
Comment thread tests/std/tests/GH_002789_Hash_vec_Tidy/test.cpp Outdated
@StephanTLavavej

Copy link
Copy Markdown
Member

Looks good, I pushed trivial changes to the test.

@StephanTLavavej

Copy link
Copy Markdown
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 5419d49 into microsoft:main Jun 16, 2022
@StephanTLavavej

Copy link
Copy Markdown
Member

Thanks for tidying up this bug! 🐞 🧹 😹

Igor Zhukov (fsb4000) pushed a commit to fsb4000/STL that referenced this pull request Aug 13, 2022
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

<xhash>: _Hash_vec::~_Tidy can deallocate(nullptr)

3 participants