NSTask Leaking...
NSTask Leaking...
- Subject: NSTask Leaking...
- From: "Mr. Gecko" <email@hidden>
- Date: Thu, 29 Jan 2009 12:20:19 -0600
Hello, I'm trying to make my own licenses system and I need MD5 to
verify that the key in the file is right and isn't a fake.
what I've got now is a NSTask that runs md5 -s salt+key+salt2 and it
works, but I am getting a leak with NSTask...
I would like to find out how to get rid of that leak; here is my code
so you can give me pointers or help me find this out.
- (NSString *)md5:(NSString *)MD5 {
NSPipe *outPipe = [NSPipe pipe];
NSTask* theTask = [[NSTask alloc] init];
[theTask setStandardOutput:[outPipe autorelease]];
[theTask setLaunchPath:@"/sbin/md5"];
[theTask setCurrentDirectoryPath:@"~/"];
[theTask setArguments:[[NSArray arrayWithObjects:@"-s", MD5, nil]
autorelease]];
[theTask launch];
[theTask waitUntilExit];
NSString *rMD5 = [[[[NSString alloc] initWithData:[[outPipe
fileHandleForReading] readDataToEndOfFile] encoding:
NSUTF8StringEncoding] componentsSeparatedByString:@" = "]
objectAtIndex:1];
[theTask release];
rMD5 = [self replace:@"\n" with:@"" source:rMD5];
return [rMD5 autorelease];
}
Thanks,
Mr. Gecko
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden