https://llvm.org/bugs/show_bug.cgi?id=25993
Bug ID: 25993 Summary: scan-build: false positive w/memset return Product: clang Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: Static Analyzer Assignee: kreme...@apple.com Reporter: vap...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified scan-build does not seem to understand the relationship between the first arg and the return value. from POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/memset.html void *memset(void *s, int c, size_t n); RETURN VALUE The memset() function shall return s; so when you have code like: #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char *s = memset(malloc(10), 0, 10); strcpy(s, "abc"); puts(s); return 0; } scan-build wrongly reports: test.c:5:2: warning: Potential memory leak char *s = memset(malloc(10), 0, 10); ^~~~~~~ 1 warning generated. scan-build: 1 bug found. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs