Menu

Why it's treated as error?

2016-07-07
2016-07-19
  • HyungKi Jeong

    HyungKi Jeong - 2016-07-07

    Why it's treated as error? (Cppcheck 1.74)

    #include "DDK_Context.h"
    
    typedef struct {
        FILE*   fp;
        DDK*    pDDK;
    } MEMORY_DUMP;
    
    BOOL DDKContext::LoadMemoryDump(const char* sFileName)
    {
        MEMORY_DUMP dump;
        dump.pDDK       = this;
    
        if((dump.fp = fopen(sFileName, "rb"))) {
    
            printf("opened...\n");
    
            fclose(dump.fp);
            return TRUE;
        }
    
        return FALSE;
    }
    

    C:\Program Files (x86)\Cppcheck>cppcheck.exe DDK_MemoryDump.cpp
    Checking DDK_MemoryDump.cpp...
    [DDK_MemoryDump.cpp:26]: (error) Memory leak: dump.fp

    Old 1.67 version is ok, but not in this recent version.

     
  • orbitcowboy

    orbitcowboy - 2016-07-19

    I have created a ticket about this issue here

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.