Skip to content

Commit

Permalink
Add autoreleasepool
Browse files Browse the repository at this point in the history
  • Loading branch information
hmelder committed Oct 25, 2024
1 parent 41e9c98 commit 2223972
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Tests/base/NSKVOSupport/userdefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#import <Foundation/NSValue.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSUserDefaults.h>
#import <Foundation/NSKeyValueObserving.h>

Expand Down Expand Up @@ -70,6 +71,7 @@ - (void)dealloc
int
main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
Observer *obs = [Observer new];
NSString *key1 = @"key1";
Expand Down Expand Up @@ -164,6 +166,8 @@ - (void)dealloc
[defs removeObserver:obs forKeyPath:key1];
[defs removeObserver:obs forKeyPath:key2];

[pool drain];
[obs release];

return 0;
}

0 comments on commit 2223972

Please sign in to comment.