2017-03-04 02:02:02 +08:00
|
|
|
// RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -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
|
|
|
|
}
|