Skip to content

Commit

Permalink
Fix a double-overrelease in the TestDataFormatterObjC test program.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@356160 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
adrian-prantl committed Mar 14, 2019
1 parent d78521c commit fc3dae0
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -624,7 +626,6 @@ int main (int argc, const char * argv[])
[molecule setAtoms:nil];
[molecule setAtoms:[NSMutableArray new]];

free(zeroes);
[pool drain];
return 0;
}
Expand Down

0 comments on commit fc3dae0

Please sign in to comment.