AutoPointer may have a memory leak

Bug #397243 reported by Iyer Arvind Sundaram
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
कर्म
Fix Committed
High
Prasad H L Bhat

Bug Description

the initialise of autopointer calls reset. This calls the ReferenceCounter::reset()->refCount set to 0. Then the reference is set to _ref. which will never be deleted. Is this intensional so that the pointer is NOT deleted?

The name autopointer is misleading for a Reference Counted Autopointer. I suggest refactoring the name to RCAutoPointer at least

Changed in project-karma:
importance: Undecided → High
Revision history for this message
Iyer Arvind Sundaram (iyer-arvind-sundaram) wrote :

I have made some changes to the code. You may check it out in my junk+. Also i have imported RCAutoPointer, which is tried and tested in another project of mine. Otherwise you can take it from my attachment. I have also implemented "operator=(DataType*)" which does essentially the same thing and it works fine.

Revision history for this message
Iyer Arvind Sundaram (iyer-arvind-sundaram) wrote :

Please verify the change and close the bug

Changed in project-karma:
assignee: nobody → H. L. Prasad (hlprasu)
Revision history for this message
Prasad H L Bhat (hlprasu) wrote :

RC prefix seems not necessary for AutoPointer as we would not have AutoPointer which is not referenced counted. Other wise, we have change the name of even List class as it also has its data reference counted. Hence, it is best to blankly put that the data storage related classes use reference counting.

A small change is done to the code sent by you. operator =() now calls the inline initialise() function.

Revision history for this message
Prasad H L Bhat (hlprasu) wrote :

The fix for this is committed in the main branch of the project.

Changed in project-karma:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.