mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
fix memory management bugs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36392 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
081cb7670c
commit
5db83d1282
1 changed files with 8 additions and 8 deletions
|
@ -717,6 +717,8 @@ typedef struct {
|
|||
{
|
||||
if (0 != _NSDateComponentsInternal)
|
||||
{
|
||||
RELEASE(_cal);
|
||||
RELEASE(_tz);
|
||||
free(_NSDateComponentsInternal);
|
||||
}
|
||||
[super dealloc];
|
||||
|
@ -910,18 +912,12 @@ typedef struct {
|
|||
|
||||
- (void) setCalendar: (NSCalendar *) cal
|
||||
{
|
||||
if (_cal)
|
||||
RELEASE(_cal);
|
||||
|
||||
_cal = RETAIN(cal);
|
||||
ASSIGN(_cal, cal);
|
||||
}
|
||||
|
||||
- (void) setTimeZone: (NSTimeZone *) tz
|
||||
{
|
||||
if (_tz)
|
||||
RELEASE(_tz);
|
||||
|
||||
_tz = RETAIN(tz);
|
||||
ASSIGN(_tz, tz);
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
|
@ -934,6 +930,10 @@ typedef struct {
|
|||
|
||||
memcpy(c->_NSDateComponentsInternal, _NSDateComponentsInternal,
|
||||
sizeof(DateComp));
|
||||
/* We gave objects to the copy, so we need to retain them too.
|
||||
*/
|
||||
RETAIN(_cal);
|
||||
RETAIN(_tz);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue