Author: adrian Date: Thu Mar 14 08:58:21 2019 New Revision: 356160 URL: http://llvm.org/viewvc/llvm-project?rev=356160&view=rev Log: Fix a double-overrelease in the TestDataFormatterObjC test program.
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m?rev=356160&r1=356159&r2=356160&view=diff ============================================================================== --- lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m (original) +++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-objc/main.m Thu Mar 14 08:58:21 2019 @@ -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; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits