[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-05-02 Thread Daniel Marjamäki via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL301913: [analyzer] Detect bad free of function pointers (authored by danielmarjamaki). Changed prior to commit: https://reviews.llvm.org/D31650?vs=95929=97432#toc Repository: rL LLVM

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-27 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. This revision is now accepted and ready to land. Looks good, thanks! Did you evaluate this on a large codebase - were warnings plentiful and were there any false positives known? I'd like to summon Anna here for a little bit because that's a new

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-20 Thread Anders Rönnholm via Phabricator via cfe-commits
AndersRonnholm updated this revision to Diff 95929. AndersRonnholm added a comment. Updated after comments Repository: rL LLVM https://reviews.llvm.org/D31650 Files: lib/StaticAnalyzer/Checkers/MallocChecker.cpp test/Analysis/malloc.c Index: test/Analysis/malloc.c

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-05 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. > void *p = malloc(sizeof(fnptr)); sorry ... I guess that should be something like "void *p = malloc(100);" Repository: rL LLVM https://reviews.llvm.org/D31650 ___ cfe-commits mailing list

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-05 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment. In https://reviews.llvm.org/D31650#717691, @NoQ wrote: > Is freeing function pointers always undefined? I guess not.. however I don't personally see why it would be useful to allocate function pointers with malloc. > I wonder what happens if we take some

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-04 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Hello, thanks for the patch! Because we already warn on freeing concrete function pointers, eg. void foo() { free(); } this is a useful addition. Is freeing function pointers always undefined? I wonder what happens if we take some JIT-enabled javascript engine,

[PATCH] D31650: [Analyzer] Detect when function pointer is freed

2017-04-04 Thread Anders Rönnholm via Phabricator via cfe-commits
AndersRonnholm created this revision. The MallocChecker does not currently detect freeing of function pointers. Example code. void (*fnptr)(int); void freeIndirectFunctionPtr() { void *p = (void*)fnptr; free(p); // expected-warning {{Argument to free() points to a function