Menu

An inconsistent behavior in the resourceLeak checker

safans
3 days ago
3 days ago
  • safans

    safans - 3 days ago

    Hi, I found inconsistent behavior in Cppcheck when analyzing the following two equivalent programs.

    Cppcheck reports a warning for the first program, but no warning for the second one. I believe this is a false negative.

    First Program with a Warning

    #include <stdio.h>
    int main()
    {
        const FILE *a = fopen("good.c", "r");
        if (!a)
            return 0;
        return 0;
    }
    

    Second Program without Warnings

    #include <stdio.h>
    int main() {
      const auto a = fopen("good.c", "r");
      if (!a)
        return 0;
      return 0;
    }
    

    Version: Cppcheck 2.22 dev

     
  • CHR

    CHR - 3 days ago

    Thanks for reporting, see https://trac.cppcheck.net/ticket/14834

     

Log in to post a comment.

Auth0 Logo