forked from OSchip/llvm-project
[analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.
llvm-svn: 153453
This commit is contained in:
parent
08e57e5ccf
commit
a651c4099d
|
@ -1257,7 +1257,8 @@ bool MallocChecker::doesNotFreeMemory(const CallOrObjCMessage *Call,
|
|||
// this would be to implement a pointer escapes callback.
|
||||
if (FName == "CVPixelBufferCreateWithBytes" ||
|
||||
FName == "CGBitmapContextCreateWithData" ||
|
||||
FName == "CVPixelBufferCreateWithPlanarBytes") {
|
||||
FName == "CVPixelBufferCreateWithPlanarBytes" ||
|
||||
FName == "OSAtomicEnqueue") {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,3 +106,14 @@ void testBlocks() {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue