mirror of https://github.com/microsoft/clang.git
[analyzer] MallocChecker: Fix one more bug category.
Even though most of the inconsistencies in MallocChecker's bug categories were fixed in r302016, one more was introduced in r301913 which was later missed. Patch by Henry Wong! Differential Revision: https://reviews.llvm.org/D43074 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324680 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d048a9ebfa
commit
b881e2ba8c
|
@ -2075,8 +2075,8 @@ void MallocChecker::ReportFunctionPointerFree(CheckerContext &C, SVal ArgVal,
|
|||
|
||||
if (ExplodedNode *N = C.generateErrorNode()) {
|
||||
if (!BT_BadFree[*CheckKind])
|
||||
BT_BadFree[*CheckKind].reset(
|
||||
new BugType(CheckNames[*CheckKind], "Bad free", "Memory Error"));
|
||||
BT_BadFree[*CheckKind].reset(new BugType(
|
||||
CheckNames[*CheckKind], "Bad free", categories::MemoryError));
|
||||
|
||||
SmallString<100> Buf;
|
||||
llvm::raw_svector_ostream Os(Buf);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: %clang_analyze_cc1 -analyzer-checker core,unix.Malloc -analyzer-output=plist -o %t.plist -verify %s
|
||||
// RUN: FileCheck --input-file=%t.plist %s
|
||||
|
||||
void free(void *);
|
||||
void (*fnptr)(int);
|
||||
void foo() {
|
||||
free((void *)fnptr); // expected-warning{{Argument to free() is a function pointer}}
|
||||
}
|
||||
|
||||
// Make sure the bug category is correct.
|
||||
// CHECK: <key>category</key><string>Memory error</string>
|
Loading…
Reference in New Issue