facebook / facebook/infer

False positive detection of USE_AFTER_DELETE in loop

Open
#1,884 0 comments 1 reaction 0 assignees View on GitHub
c++
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

Hi,

this error :
```
src/core/execution/graph.cpp:175: error: Use After Delete
accessing `v` that was invalidated by `delete` on line 175.
173. /* delete vertices from _vertices and clear */
174. for (auto* v : _vertices) {
175. delete v;
^
176. }
177. _vertices.clear ();

Found 1 issue
Issue Type(ISSUED_TYPE_ID): #
Use After Delete(USE_AFTER_DELETE): 1
```

seems a false positive (?), or I missed something very obvious... Same error if I use an iterator-based loop instead of a range-based loop.

Best regards.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.