[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
Tue Sep 29 11:03:20 CDT 2009


The following issue has been SUBMITTED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15987 
====================================================================== 
Reported By:                kpfleming
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15987
Category:                   Core/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           Older 1.4 
JIRA:                        
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-09-29 11:03 CDT
Last Modified:              2009-09-29 11:03 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-09-29 11:03 kpfleming      New Issue                                    
2009-09-29 11:03 kpfleming      Asterisk Version          => Older 1.4       
2009-09-29 11:03 kpfleming      Regression                => No              
2009-09-29 11:03 kpfleming      SVN Branch (only for SVN checkouts, not tarball
releases) => N/A             
======================================================================




More information about the asterisk-bugs mailing list