Is there a leak in this copy code?
- by Don Wilson
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]