From 8ce585cf3e1deecc4a34b058e10b7976bcc8e7f2 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Wed, 30 Sep 2009 21:07:28 +0000 Subject: [PATCH] fix double free in SpringBoardAccess --- SpringBoardAccess/SpringBoardAccess-test.c | 2 +- SpringBoardAccess/SpringBoardAccessExtension.mm | 5 +---- TODO.txt | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/SpringBoardAccess/SpringBoardAccess-test.c b/SpringBoardAccess/SpringBoardAccess-test.c index 809924ab1..189fad652 100644 --- a/SpringBoardAccess/SpringBoardAccess-test.c +++ b/SpringBoardAccess/SpringBoardAccess-test.c @@ -22,7 +22,7 @@ int main(int argc, char *argv[]) { } if (usage) { - printf("Usage: %s add/remove StatuBarImageName", argv[0]); + printf("Usage: %s add/remove StatuBarImageName\n", argv[0]); return -1; } } diff --git a/SpringBoardAccess/SpringBoardAccessExtension.mm b/SpringBoardAccess/SpringBoardAccessExtension.mm index 88a02c66b..d3e8dd81b 100644 --- a/SpringBoardAccess/SpringBoardAccessExtension.mm +++ b/SpringBoardAccess/SpringBoardAccessExtension.mm @@ -28,15 +28,13 @@ _ ## class ## $ ## name(self, sel, ## args) CFDataRef myCallBack(CFMessagePortRef local, SInt32 msgid, CFDataRef cfData, void *info) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - UIApplication *theApp = [UIApplication sharedApplication]; const char *data = (const char *) CFDataGetBytePtr(cfData); UInt16 dataLen = CFDataGetLength(cfData); if (dataLen > 1 && data) { - NSString * name = [[NSString stringWithCString:&data[1] encoding:NSASCIIStringEncoding] autorelease]; + NSString * name = [NSString stringWithCString:&data[1] encoding:NSASCIIStringEncoding]; switch (data[0]){ case SBAC_addStatusBarImage: [theApp addStatusBarImageNamed:name]; @@ -48,7 +46,6 @@ CFDataRef myCallBack(CFMessagePortRef local, SInt32 msgid, CFDataRef cfData, voi NSLog(@"Unknown command %u, len %u", data[0], dataLen); } } - [pool release]; return NULL; // as stated in header, both data and returnData will be released for us after callback returns } diff --git a/TODO.txt b/TODO.txt index 12c0187ef..d016a3d9d 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,7 @@ /* new todo file for BTstack */ Last milestone reached: create script to build APT package for BTdeamon, Resources, and BTstack client library -Last change: clean up command names and headers +Last change: fix doulbe free in SpringBoardAccess NEXT: