[asterisk-bugs] [Asterisk 0015987]: ao2_iterator_init() does not hold a reference to the container it is iterating

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Oct 5 20:19:48 CDT 2009


The following issue has been RESOLVED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15987 
====================================================================== 
Reported By:                kpfleming
Assigned To:                kpfleming
====================================================================== 
Project:                    Asterisk
Issue ID:                   15987
Category:                   Core/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Asterisk Version:           Older 1.4 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-09-29 11:03 CDT
Last Modified:              2009-10-05 20:19 CDT
====================================================================== 
Summary:                    ao2_iterator_init() does not hold a reference to the
container it is iterating
Description: 
While researching the astobj2 code to add some new functionality, I
discovered that the ao2_iterator_init() function makes a copy of the
container pointer it is passed, but does not increase the reference count
on the container. In situations where dynamically allocated containers are
being used and pointers to them are passed to (and iterators create on them
by) other functions, this could lead to the container being destroyed while
there are still iterators open using it.

There are no current usages of astobj2 in the tree that could experience
this problem, as they do not use dynamically allocated containers with
short lifetimes (all existing container usage would outlive any iterators
that might be used on those containers), but the API is clearly not living
up to the 'automatic reference count management' that developers would
expect it to have.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-10-05 20:19 svnbot         Status                   assigned => resolved
2009-10-05 20:19 svnbot         Resolution               open => fixed       
======================================================================




More information about the asterisk-bugs mailing list