2011-09-02 13:55:19 +08:00
|
|
|
// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify %s
|
2008-10-23 04:54:52 +08:00
|
|
|
|
|
|
|
typedef struct CGColorSpace *CGColorSpaceRef;
|
|
|
|
extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
|
|
|
|
extern CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef space);
|
|
|
|
extern void CGColorSpaceRelease(CGColorSpaceRef space);
|
|
|
|
|
|
|
|
void f() {
|
2009-02-05 07:49:09 +08:00
|
|
|
CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); // expected-warning{{leak}}
|
|
|
|
CGColorSpaceRetain(X);
|
2008-10-23 04:54:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void fb() {
|
|
|
|
CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB();
|
|
|
|
CGColorSpaceRetain(X);
|
|
|
|
CGColorSpaceRelease(X);
|
|
|
|
CGColorSpaceRelease(X); // no-warning
|
|
|
|
}
|