Cppcheck emits no mismatchAllocDealloc diagnostic. Its checker report confirms that the warning configuration is active. Removing the indexed member access makes Cppcheck report the mismatch.
Expected behavior
Cppcheck should report that item, allocated by scalar new, is incorrectly released by delete[].
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I found a false negative in Cppcheck 2.21.0 when an indexed member access occurs between a scalar allocation and mismatched array deletion.
Affected tool
Cppcheck 2.21.0Affected checker
mismatchAllocDeallocMinimal reproducer
Reproduction command
Current behavior
Cppcheck emits no
mismatchAllocDeallocdiagnostic. Its checker report confirms that the warning configuration is active. Removing the indexed member access makes Cppcheck report the mismatch.Expected behavior
Cppcheck should report that
item, allocated by scalarnew, is incorrectly released bydelete[].Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15035