https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100615
Bug ID: 100615
Summary: analyzer failed to report leak in rxtxcpu's
parse_cpu_list
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: analyzer
Assignee: dmalcolm at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Target Milestone: ---
clang's static analyzer found this leak on an error-handling path:
https://github.com/stackpath/rxtxcpu/pull/42
which gcc's -fanalyzer failed to report.
Looking at the code, I see that the string is passed to strsep and to strtol,
which IIRC the analyzer doesn't have special knowledge of (perhaps the analyzer
is conservatively assuming that these could free the string?)