Menu

Memory alloc arg parameter

2018-04-23
2018-04-24
  • Steve Grubb

    Steve Grubb - 2018-04-23

    Hello,

    I am writing a cfg library to test pam usage on Linux. The pam_start function allocates memory in a pointer to a pointer as its fourth argument. This is very similar to the gettaddrinfo function found in posix.cfg. If I test the getaddrinfo leak detection with the following code:

    void test(void)
    {
            char tmp_name[255];
            struct addrinfo *ai;
            struct addrinfo hints;
            memset(&hints, 0, sizeof(hints));
            getaddrinfo(tmp_name, NULL, &hints, &ai);
    }
    

    It does not report the memory leak as ai goes out of scope. Looking at the source code to cppcheck, it appears that "arg" is parsed in the "alloc" xml parser. Is this a feature that is still under development?

    Best Regards,
    -Steve

     

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.