forked from OSchip/llvm-project
[analyzer]Fix false positive: pointer might escape through CG*WithData.
llvm-svn: 154156
This commit is contained in:
parent
f1548d4f74
commit
e8628c5bc7
|
@ -278,6 +278,7 @@ public:
|
||||||
if (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
|
if (StrInStrNoCase(FName, "InsertValue") != StringRef::npos||
|
||||||
StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
|
StrInStrNoCase(FName, "AddValue") != StringRef::npos ||
|
||||||
StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
|
StrInStrNoCase(FName, "SetValue") != StringRef::npos ||
|
||||||
|
StrInStrNoCase(FName, "WithData") != StringRef::npos ||
|
||||||
StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
|
StrInStrNoCase(FName, "AppendValue") != StringRef::npos||
|
||||||
StrInStrNoCase(FName, "SetAttribute") != StringRef::npos) {
|
StrInStrNoCase(FName, "SetAttribute") != StringRef::npos) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -136,3 +136,21 @@ static inline void radar11111210(OSQueueHead *pool) {
|
||||||
OSAtomicEnqueue(pool, newItem, 4);
|
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);
|
||||||
|
}
|
Loading…
Reference in New Issue