[analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.

llvm-svn: 153453
This commit is contained in:
Anna Zaks 2012-03-26 18:18:39 +00:00
parent 08e57e5ccf
commit a651c4099d
2 changed files with 13 additions and 1 deletions

View File

@ -1257,7 +1257,8 @@ bool MallocChecker::doesNotFreeMemory(const CallOrObjCMessage *Call,
// this would be to implement a pointer escapes callback. // this would be to implement a pointer escapes callback.
if (FName == "CVPixelBufferCreateWithBytes" || if (FName == "CVPixelBufferCreateWithBytes" ||
FName == "CGBitmapContextCreateWithData" || FName == "CGBitmapContextCreateWithData" ||
FName == "CVPixelBufferCreateWithPlanarBytes") { FName == "CVPixelBufferCreateWithPlanarBytes" ||
FName == "OSAtomicEnqueue") {
return false; return false;
} }

View File

@ -106,3 +106,14 @@ void testBlocks() {
myBlock(3); myBlock(3);
} }
// Test that we handle pointer escaping through OSAtomicEnqueue.
typedef volatile struct {
void *opaque1;
long opaque2;
} OSQueueHead;
void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset) __attribute__((weak_import));
static inline void radar11111210(OSQueueHead *pool) {
void *newItem = malloc(4);
OSAtomicEnqueue(pool, newItem, 4);
}