From 942bcb816ed7c92f52c5ef8f8ac12384bcb5b3b9 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Sat, 10 Oct 2009 18:33:37 +0000 Subject: [PATCH] Monotone-Parent: 1d41463c98c6e569d444ae5521059b400945db56 Monotone-Revision: 33d9fe1bf74ac6ca66a70020477a738afbd9c379 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-10-10T18:33:37 Monotone-Branch: ca.inverse.sogo --- SOPE/NGCards/CardElement.m | 18 ++++++++++++++---- SOPE/NGCards/ChangeLog | 6 ++++++ .../NGCards/versitCardsSaxDriver/VSSaxDriver.m | 2 +- 3 files changed, 21 insertions(+), 5 deletions(-) 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; }