Skip to content

Don't cast the pointer type for delete - #121369

Merged
jkotas merged 1 commit into
mainfrom
jkoritzinsky-patch-1
Nov 5, 2025
Merged

jkotas merged 1 commit into
mainfrom
jkoritzinsky-patch-1

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

This was causing asan errors.

Fixes #121339

This was causing asan errors.

Fixes #121339
Copilot AI review requested due to automatic review settings November 5, 2025 03:51
@github-actions github-actions Bot added the area-PAL-coreclr only for closed issues label Nov 5, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes an unnecessary C-style cast when deleting a USynchCacheStackNode pointer in the Add method of the CSynchCache template class.

Key Changes:

  • Simplified the delete operation by removing the (char *) cast in the Add method, making the code cleaner and type-safe.
Comments suppressed due to low confidence (1)

src/coreclr/pal/src/include/pal/synchcache.hpp:181

  • The Flush method on line 181 still uses the same C-style cast pattern delete (char *)pTemp; that was just removed from line 156. For consistency and type safety, this should also be changed to delete pTemp; since pTemp is already a USynchCacheStackNode * pointer allocated with new USynchCacheStackNode().
                delete (char *)pTemp;

@jkotas

jkotas commented Nov 5, 2025

Copy link
Copy Markdown
Member

/ba-g Android timeouts

@jkotas
jkotas merged commit 6d0ac32 into main Nov 5, 2025
@jkotas
jkotas deleted the jkoritzinsky-patch-1 branch November 12, 2025 05:17
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-PAL-coreclr only for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CLR] ASAN CloseHandle new-delete-type-mismatch

3 participants