diff options
author | Anna Zaks <ganna@apple.com> | 2012-06-20 23:35:57 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-06-20 23:35:57 +0000 |
commit | 886dfb8cfa01d963803f872d9d756fcc11f650fb (patch) | |
tree | 6afe7b4edabe8884d173ca45eb34dfad1091fa9e /clang/test/Analysis/malloc.c | |
parent | 15019879511d98b8c489c857eba110b85f7b1a8c (diff) | |
download | bcm5719-llvm-886dfb8cfa01d963803f872d9d756fcc11f650fb.tar.gz bcm5719-llvm-886dfb8cfa01d963803f872d9d756fcc11f650fb.zip |
[analyzer] Malloc leak false positive: Allow xpc context to escape.
llvm-svn: 158875
Diffstat (limited to 'clang/test/Analysis/malloc.c')
-rw-r--r-- | clang/test/Analysis/malloc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c index c532d6813f4..9596751a0d6 100644 --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -974,3 +974,16 @@ void testCGContextLeak() // object doesn't escape and it hasn't been freed in this function. } +// Allow xpc context to escape. radar://11635258 +// TODO: Would be great if we checked that the finalize_connection_context actually releases it. +static void finalize_connection_context(void *ctx) { + int *context = ctx; + free(context); +} +void foo (xpc_connection_t peer) { + int *ctx = calloc(1, sizeof(int)); + xpc_connection_set_context(peer, ctx); + xpc_connection_set_finalizer_f(peer, finalize_connection_context); + xpc_connection_resume(peer); +} + |