Is there a leak in this copy code?

Posted by Don Wilson on Stack Overflow See other posts from Stack Overflow or by Don Wilson
Published on 2011-01-10T03:49:06Z Indexed on 2011/01/10 3:53 UTC
Read the original article Hit count: 202

Filed under:

Is there a leak in this code?

// Move the group
 Group *movedGroup = [[Group alloc] init];
 movedGroup = [[[[GroupList sharedGroupList] groups] objectAtIndex:fromIndex] copy];
 [[GroupList sharedGroupList] deleteGroup:fromIndex];
 [[GroupList sharedGroupList] insertGroup:movedGroup atIndex:toIndex];

 // Update the loadedGroupIndex pointer
 if (loadedGroupIndex < fromIndex & loadedGroupIndex >= toIndex) {
  loadedGroupIndex = loadedGroupIndex + 1;
 } else if (loadedGroupIndex > fromIndex & loadedGroupIndex < toIndex) {
  loadedGroupIndex = loadedGroupIndex - 1;
 } else if (loadedGroupIndex == fromIndex) {
  loadedGroupIndex = toIndex;
 }
 [movedGroup release]

© Stack Overflow or respective owner

Related posts about iphone