Menu

cfg for scandir

Mavik
2018-10-18
2018-10-29
  • Mavik

    Mavik - 2018-10-18

    I'd like to write a cfg file entry for the posix scandir() function that enables cppcheck to detect memory leaks associated with that function.

    int scandir(const char *dirp, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **));

    After calling calling scandir() it is necessary to call free(namelist). It wasn't obvious to me from the cppcheck manual, Library Editor or other cfg files what settings I need to make for arg2 so cppcheck is aware of the need for the free() call.

     
  • Daniel Marjamäki

    I could be wrong.. but as far as I remember you can't configure this. And after a quick look.. it does not seem we have a ticket that is directly applicable. There are a few tickets with keyword "library" about memory leaks, so I guess they are a bit related. Feel free to open a new ticket.

     
  • versat

    versat - 2018-10-29

    This ticket is releated:
    https://trac.cppcheck.net/ticket/6994 ("Please enable memory leak check to function ("output") arguments also").

     

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.