diff --git a/SOPE/NGCards/CardElement.m b/SOPE/NGCards/CardElement.m index 079221f37..a66c41877 100644 --- a/SOPE/NGCards/CardElement.m +++ b/SOPE/NGCards/CardElement.m @@ -557,10 +557,15 @@ - (id) copyWithZone: (NSZone *) aZone { CardElement *new; + NSString *newTag, *newGroup; new = [[self class] new]; - [new setTag: [tag copyWithZone: aZone]]; - [new setGroup: [group copyWithZone: aZone]]; + newTag = [tag copyWithZone: aZone]; + [new setTag: newTag]; + [newTag release]; + newGroup = [group copyWithZone: aZone]; + [new setGroup: newGroup]; + [newGroup release]; [new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]]; [new setAttributesAsCopy: [self deepCopyOfDictionary: attributes withZone: aZone]]; @@ -572,10 +577,15 @@ - (id) mutableCopyWithZone: (NSZone *) aZone { CardElement *new; + NSString *newTag, *newGroup; new = [[self class] new]; - [new setTag: [tag mutableCopyWithZone: aZone]]; - [new setGroup: [group mutableCopyWithZone: aZone]]; + newTag = [tag copyWithZone: aZone]; + [new setTag: newTag]; + [newTag release]; + newGroup = [group copyWithZone: aZone]; + [new setGroup: newGroup]; + [newGroup release]; [new setValuesAsCopy: [self deepCopyOfArray: values withZone: aZone]]; [new setAttributesAsCopy: [self deepCopyOfDictionary: attributes withZone: aZone]]; diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index ac5cc2344..561315d84 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,9 @@ +2009-10-10 Wolfgang Sourdeau + + * CardElement.m (-copyWithZone:): we release the "tag" and the + "group" copy to avoid a leak. + (-mutableCopyWithZone): same as above. + 2009-09-24 Wolfgang Sourdeau * NSArray+NGCards.m (-renderedForCards): insert the non-blank diff --git a/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m b/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m index c06a370c3..77e2b522c 100644 --- a/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m +++ b/SOPE/NGCards/versitCardsSaxDriver/VSSaxDriver.m @@ -95,7 +95,7 @@ - (id) initEndTag: (NSString *) _tag { type = 'E'; - tagName = [_tag copy]; + ASSIGN (tagName, _tag); return self; }