abhishekshrivastava972 / fskit

Automatically exported from code.google.com/p/fskit
0 stars 0 forks source link

Introduction page shows incorrect usage #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The Introduction page (http://code.google.com/p/fskit/wiki/Introduction) 
suggests that to use 
FSKit, one should first create an FSKConnection object as follows:


FSKConnection *connection  = [[[FSKConnection alloc] init] retain];

This will almost certainly create a memory leak when not using garbage 
collection, since the 
'alloc' call will retain the object once, and the 'retain' call will retain it 
a second time. Unless the 
user is expected to call 'release' twice, this will introduce a memory leak.

It should be 
FSKConnection *connection  = [[FSKConnection alloc] init];

or 


FSKConnection *connection  = [[[FSKConnection alloc] init] autorelease];

This same incorrect pattern is also present in FSRequest.m, on line 22. 
(http://www.google.com/codesearch/p?
hl=en#XhtP_lh4BFk/trunk/FSKit/Source/Common/FSKRequest.m&q=retain%20package:http
://fs
kit%5C.googlecode%5C.com&sa=N&cd=8&ct=rc&l=22)

Original issue reported on code.google.com by bjho...@gmail.com on 2 May 2010 at 2:37