3 int *p
= (int *)malloc(sizeof(int));
8 void __attribute((ownership_returns(malloc
))) *user_malloc(size_t);
11 int *p
= (int *)user_malloc(sizeof(int));
24 realloc(p
, sizeof(long)); // warn
29 struct SimpleSmartPointer
{
32 explicit SimpleSmartPointer(T
*p
= 0) : ptr(p
) {}
33 ~SimpleSmartPointer() {
39 SimpleSmartPointer
<int> a((int *)malloc(4));
44 int *p
= (int *)operator new(0);
49 void test(NSUInteger dataLength
) {
51 NSData
*d
= [NSData dataWithBytesNoCopy
:p
52 length
:sizeof(int) freeWhenDone
:1];
53 // warn +dataWithBytesNoCopy:length:freeWhenDone: cannot take
54 // ownership of memory allocated by 'new'