summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m9
1 files changed, 5 insertions, 4 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
index 859b77c312c..a370a48739c 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -406,9 +406,11 @@ int main (int argc, const char * argv[])
// No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified.
unsigned concreteLength = 100000;
- void *zeroes = calloc(1, concreteLength);
- NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes length:concreteLength];
- NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes length:concreteLength];
+ void *zeroes1 = calloc(1, concreteLength);
+ // initWithBytesNoCopy takes ownership of the buffer.
+ NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1 length:concreteLength];
+ void *zeroes2 = calloc(1, concreteLength);
+ NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength];
[mutableData appendBytes:"MOREDATA" length:8];
@@ -624,7 +626,6 @@ int main (int argc, const char * argv[])
[molecule setAtoms:nil];
[molecule setAtoms:[NSMutableArray new]];
- free(zeroes);
[pool drain];
return 0;
}
OpenPOWER on IntegriCloud