Malloc+NewDelete_intersections.cpp revision 648cb71625a2ab3164b2cacac9e9cb3d22b03bd7
1// 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'}} 15