Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objc_message_field.cc and objc_enum_field.cc generate code that leaks copied objects #4

Closed
macdrevx opened this issue Aug 25, 2011 · 3 comments
Assignees

Comments

@macdrevx
Copy link
Contributor

On line 365 of objc_message_field.cc and on line 343 of objc_enum_field.cc, the copied object is assigned to a retain property. The copied objects, should therefore be autoreleased.

This issue was flagged in generated code in another project by the Xcode 4.1 static analyzer.

@ghost ghost assigned jparise Aug 25, 2011
@jparise
Copy link
Contributor

jparise commented Aug 25, 2011

Thanks for spotting that! -autorelease is fine here, but we could also assign the array copy to a local variable and -release it immediately after using it to set the property.

@jparise jparise closed this as completed Aug 25, 2011
@macdrevx
Copy link
Contributor Author

Yes, that is probably a better way to go.

Will you be updating the project to use automatic reference counting at some point? I noticed that one person has made a first pass at doing so in another fork of the project.

Andrew Hershberger

On Thursday, August 25, 2011 at 3:27 PM, jparise wrote:

Thanks for spotting that! -autorelease is fine here, but we could also assign the array copy to a local variable and -release it immediately after using it to set the property.

Reply to this email directly or view it on GitHub:
#4 (comment)

@jparise
Copy link
Contributor

jparise commented Aug 25, 2011

I don't have any plans to do anything with ARC at the moment, but I'm open to patches.

qzix pushed a commit to qzix/protobuf-objc that referenced this issue May 27, 2014
objc_message_field.cc and objc_enum_field.cc generate code that leaks
copied objects. See booyah#4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants