User Activity

  • Posted a comment on discussion General Discussion on cppcheck

    I posted a query on stack overflow with sample code, but did not get any response there. Can you confirm if this is expected behaviour, or is there a way to work around this? void f1(const char *s) { printf("f1"); } int main() { char *s = calloc(10, sizeof(char)); f1(s); // memleak is reported only if this is commented out return 0; } https://stackoverflow.com/q/78845892/165297 Is it just that cppcheck does not look in to how the called function is using the pointer, and rather relies on the data...

  • Posted a comment on discussion General Discussion on cppcheck

    Thank you! That was really fast :)

  • Posted a comment on discussion General Discussion on cppcheck

    In the following snippet, cppcheck does not report a memleak if the return value is explicitly compared against a value, as in the case of a2. But at the same time, if we just check if (getaddrinfo()) as in the case of a1, which is a widely used pattern to check if the function returned zero or not, it reports a false positive memleak. Invocation command was cppcheck --library=posix.cfg main.c, and the version was 2.14.2 struct addrinfo *a1 = NULL; if (getaddrinfo("a", "b", NULL, &a1)) { return -1;...

View All

Personal Data

Username:
amarghosh
Joined:
2009-11-04 12:06:43

Projects

  • No projects to display.

Personal Tools