Invalid detection of use after delete
Open
0.7
private-detectors
- Dominant language
- Python
- Stars
- 6.4k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Please consider the following code using libraries:
```
function cleanupTickets(Storage storage self) internal {
delete self.tickets;
self.tail = 0;
}
```
`use-after-delete` detector reports:
> Using values of variables after they have been explicitly deleted may lead to unexpected behavior or compromise
>
> GroupSelection.cleanupTickets(GroupSelection.Storage) uses a variable after it was deleted
> - Delete: delete self.tickets
> - Use: self.tail = 0
I think the detector is wrong, and it's looking only at `self` part of the line. We are deleting `self.tickets` and `self.tail` can be safely used.
Contributor guide
Assessment
This issue has not been assessed yet.