fix double free in SpringBoardAccess

This commit is contained in:
matthias.ringwald 2009-09-30 21:07:28 +00:00
parent 3d7d58e9fa
commit 8ce585cf3e
3 changed files with 3 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -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
}

View File

@ -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: