summaryrefslogtreecommitdiffstats
path: root/test/Analysis/malloc-fnptr-plist.c
blob: 6490eeb1cc0368c306a8e4cbcdd0eed39468af33 (plain)
1
2
3
4
5
6
7
8
9
10
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>