Menu

Inconsistent resourceLeak Warning

safans
2 days ago
23 hours ago
  • safans

    safans - 2 days ago

    Hi, I found an inconsistent behavior in the resourceLeak detector. Please see the two programs below.

    Cppcheck should report consistent resourceLeak warnings for both programs. However, it reports a warning for the first program but does not report any warning for the second one. Therefore, I believe this is inconsistent behavior.

    First Program

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

    Second Program

    #include <cstdio>
    auto main() -> int {
      const FILE *a = fopen("good.c", "r");
      if (!a)
        return 0;
    
      return 0;
    }
    
     
  • CHR

    CHR - 23 hours ago

    Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14842

     

Log in to post a comment.

Auth0 Logo