forked from OSchip/llvm-project
Add a test for NSURL deallocation (issue 70)
llvm-svn: 158843
This commit is contained in:
parent
df7dffb34b
commit
50e788b724
|
@ -14,4 +14,5 @@ extern "C" {
|
||||||
void TestGCDSourceCancel();
|
void TestGCDSourceCancel();
|
||||||
void TestGCDGroupAsync();
|
void TestGCDGroupAsync();
|
||||||
void TestOOBNSObjects();
|
void TestOOBNSObjects();
|
||||||
|
void TestNSURLDeallocation();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#import <CoreFoundation/CFBase.h>
|
#import <CoreFoundation/CFBase.h>
|
||||||
#import <Foundation/NSObject.h>
|
#import <Foundation/NSObject.h>
|
||||||
|
#import <Foundation/NSURL.h>
|
||||||
|
|
||||||
void CFAllocatorDefaultDoubleFree() {
|
void CFAllocatorDefaultDoubleFree() {
|
||||||
void *mem = CFAllocatorAllocate(kCFAllocatorDefault, 5, 0);
|
void *mem = CFAllocatorAllocate(kCFAllocatorDefault, 5, 0);
|
||||||
|
@ -223,3 +224,12 @@ void TestOOBNSObjects() {
|
||||||
[anObject access:11];
|
[anObject access:11];
|
||||||
[anObject release];
|
[anObject release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestNSURLDeallocation() {
|
||||||
|
NSURL *base =
|
||||||
|
[[NSURL alloc] initWithString:@"file://localhost/Users/glider/Library/"];
|
||||||
|
volatile NSURL *u =
|
||||||
|
[[NSURL alloc] initWithString:@"Saved Application State"
|
||||||
|
relativeToURL:base];
|
||||||
|
[u release];
|
||||||
|
}
|
||||||
|
|
|
@ -2049,6 +2049,13 @@ TEST(AddressSanitizerMac, NSObjectOOB) {
|
||||||
// Make sure that our allocators are used for NSObjects.
|
// Make sure that our allocators are used for NSObjects.
|
||||||
EXPECT_DEATH(TestOOBNSObjects(), "heap-buffer-overflow");
|
EXPECT_DEATH(TestOOBNSObjects(), "heap-buffer-overflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure that correct pointer is passed to free() when deallocating a
|
||||||
|
// NSURL object.
|
||||||
|
// See http://code.google.com/p/address-sanitizer/issues/detail?id=70.
|
||||||
|
TEST(AddressSanitizerMac, DISABLED_NSURLDeallocation) {
|
||||||
|
TestNSURLDeallocation();
|
||||||
|
}
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
// Test that instrumentation of stack allocations takes into account
|
// Test that instrumentation of stack allocations takes into account
|
||||||
|
|
Loading…
Reference in New Issue