Memory management issue in ODataServiceException

Oct 12, 2010 at 3:47 PM

In its initWithError:contentType:headers:statusCode: method, values assigned to member variables, not to properties. It may cause these member variables to be overreleased in future.

 

-(id) initWithError:(NSString *)anError contentType:(NSString *)aContentType headers:(NSDictionary *)aHeaders statusCode:(NSInteger)aStatusCode
{
	if(self=[super initWithName:@"ODataServiceException" reason:anError userInfo:nil])
	{
		
		m_error=anError;
		m_headers=[[NSDictionary alloc]initWithDictionary:aHeaders];
		m_statusCode=aStatusCode;
	}
	
	return self;
}

Values should be assigned to properties, e.g. self.m_error=anError etc.

Oct 13, 2010 at 7:55 PM

Thanks for reporting the issue.

I'm working on a new release of the library so I'll make sure this problem is fixed.

Claudio

 

Mar 12, 2011 at 12:44 AM

This is fixed in Version 1.2.

Direct assignment (i.e., m_error=anError;) doesn't call the setter. We modified the code as follows.


self.m_error=anError;
 

The following are equivalent, and we used both of them interchangeably in the current code:


1)self.m_error=anError;
2)[self setError:anError];