1*67e74705SXin Li // RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete -std=c++11 -verify %s 2*67e74705SXin Li // RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc,cplusplus.NewDelete,cplusplus.NewDeleteLeaks -std=c++11 -verify %s 3*67e74705SXin Li 4*67e74705SXin Li typedef __typeof(sizeof(int)) size_t; 5*67e74705SXin Li void *malloc(size_t); 6*67e74705SXin Li void free(void *); 7*67e74705SXin Li 8*67e74705SXin Li //------------------------------------------------------------------- 9*67e74705SXin Li // Check that unix.Malloc + cplusplus.NewDelete does not enable 10*67e74705SXin Li // warnings produced by unix.MismatchedDeallocator. 11*67e74705SXin Li //------------------------------------------------------------------- testMismatchedDeallocator()12*67e74705SXin Livoid testMismatchedDeallocator() { 13*67e74705SXin Li int *p = (int *)malloc(sizeof(int)); 14*67e74705SXin Li delete p; 15*67e74705SXin Li } // expected-warning{{Potential leak of memory pointed to by 'p'}} 16