blob: 7a0ef8e13c6f46df87c1fbae8418b2af3e259711 [file] [log] [blame]
Anton Yartsev648cb712013-04-04 23:46:29 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,alpha.cplusplus.NewDelete -analyzer-store region -std=c++11 -verify %s
2
3typedef __typeof(sizeof(int)) size_t;
4void *malloc(size_t);
5void free(void *);
6
7//-------------------------------------------------------------------
8// Check that unix.Malloc + alpha.cplusplus.NewDelete does not enable
9// warnings produced by unix.MismatchedDeallocator.
10//-------------------------------------------------------------------
11void testMismatchedDeallocator() {
12 int *p = (int *)malloc(sizeof(int));
13 delete p;
14} // expected-warning{{Memory is never released; potential leak of memory pointed to by 'p'}}