diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/Analysis/keychainAPI.m | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/Analysis/keychainAPI.m')
-rw-r--r-- | test/Analysis/keychainAPI.m | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/Analysis/keychainAPI.m b/test/Analysis/keychainAPI.m index fe6c61d..4fc48c0 100644 --- a/test/Analysis/keychainAPI.m +++ b/test/Analysis/keychainAPI.m @@ -76,9 +76,9 @@ void errRetVal() { UInt32 length; void *outData; st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &outData); - if (st == GenericError) // expected-warning{{Allocated data is not released: missing a call to 'SecKeychainItemFreeContent'}} + if (st == GenericError) SecKeychainItemFreeContent(ptr, outData); // expected-warning{{Only call free if a valid (non-NULL) buffer was returned}} -} +} // expected-warning{{Allocated data is not released: missing a call to 'SecKeychainItemFreeContent'}} // If null is passed in, the data is not allocated, so no need for the matching free. void fooDoNotReportNull() { @@ -305,6 +305,25 @@ void DellocWithCFStringCreate4(CFAllocatorRef alloc) { } } +static CFAllocatorRef gKeychainDeallocator = 0; + +static CFAllocatorRef GetKeychainDeallocator() { + return gKeychainDeallocator; +} + +CFStringRef DellocWithCFStringCreate5(CFAllocatorRef alloc) { + unsigned int *ptr = 0; + OSStatus st = 0; + UInt32 length; + void *bytes; + char * x; + st = SecKeychainItemCopyContent(2, ptr, ptr, &length, &bytes); + if (st == noErr) { + return CFStringCreateWithBytesNoCopy(alloc, bytes, length, 5, 0, GetKeychainDeallocator()); // no-warning + } + return 0; +} + void radar10508828() { UInt32 pwdLen = 0; void* pwdBytes = 0; |