I Have this function that allocating and initializing object :
+(Item*)getItem:(NSString*)uid{
Item *file = [[Item alloc]init];
//do some stuff
return file;
}
and this is the call for this function:
Item *tmp = [LibraryScan getItem:itemid];
//do some stuff
[tmp release];
Now i want to release it after i get it,like i write above.
Have I done it right?
In my opinion, you should autorelease the object before returning it, letting the caller decide if he wants ownership on it :
So :