diff options
author | Anna Zaks <ganna@apple.com> | 2012-04-06 01:00:47 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-04-06 01:00:47 +0000 |
commit | e8628c5bc731ce04cd6f918733e1b83ae269a20c (patch) | |
tree | cbf6e4212322eeb95f01eb39d6eaacac950dc8ec /clang/test/Analysis/malloc.mm | |
parent | f1548d4f740b47ade23911ed3fbd4e16c2b53089 (diff) | |
download | bcm5719-llvm-e8628c5bc731ce04cd6f918733e1b83ae269a20c.tar.gz bcm5719-llvm-e8628c5bc731ce04cd6f918733e1b83ae269a20c.zip |
[analyzer]Fix false positive: pointer might escape through CG*WithData.
llvm-svn: 154156
Diffstat (limited to 'clang/test/Analysis/malloc.mm')
-rw-r--r-- | clang/test/Analysis/malloc.mm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.mm b/clang/test/Analysis/malloc.mm index d2409ac1609..3515a4f99af 100644 --- a/clang/test/Analysis/malloc.mm +++ b/clang/test/Analysis/malloc.mm @@ -136,3 +136,21 @@ static inline void radar11111210(OSQueueHead *pool) { OSAtomicEnqueue(pool, newItem, 4); } +// Pointer might escape through CGDataProviderCreateWithData (radar://11187558). +typedef struct CGDataProvider *CGDataProviderRef; +typedef void (*CGDataProviderReleaseDataCallback)(void *info, const void *data, + size_t size); +extern CGDataProviderRef CGDataProviderCreateWithData(void *info, + const void *data, size_t size, + CGDataProviderReleaseDataCallback releaseData) + __attribute__((visibility("default"))); +void *calloc(size_t, size_t); + +static void releaseDataCallback (void *info, const void *data, size_t size) { +#pragma unused (info, size) + free((void*)data); +} +void testCGDataProviderCreateWithData() { + void* b = calloc(8, 8); + CGDataProviderRef p = CGDataProviderCreateWithData(0, b, 8*8, releaseDataCallback); +}
\ No newline at end of file |