1// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -analyzer-constraints=range -verify %s
2
3typedef struct CGColorSpace *CGColorSpaceRef;
4extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
5extern CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef space);
6extern void CGColorSpaceRelease(CGColorSpaceRef space);
7
8void f() {
9  CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); // expected-warning{{leak}}
10  CGColorSpaceRetain(X);
11}
12
13void fb() {
14  CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB();
15  CGColorSpaceRetain(X);
16  CGColorSpaceRelease(X);
17  CGColorSpaceRelease(X);  // no-warning
18}
19