[asterisk-dev] [asterisk-commits] mmichelson: trunk r165330 - /trunk/res/res_odbc.c

Mark Michelson mmichelson at digium.com
Thu Dec 18 10:19:36 CST 2008


Tilghman Lesher wrote:
>> Author: mmichelson
>> Date: Wed Dec 17 15:46:19 2008
>> New Revision: 165330
>>
>> URL: http://svn.digium.com/view/asterisk?view=rev&rev=165330
>> Log:
>> Fix a refcount leak in res_odbc
>>
>>
>> Modified:
>>     trunk/res/res_odbc.c
>>
>> Modified: trunk/res/res_odbc.c
>> URL:
>> http://svn.digium.com/view/asterisk/trunk/res/res_odbc.c?view=diff&rev=1653
>> 30&r1=165329&r2=165330
>> ===========================================================================
>> === --- trunk/res/res_odbc.c (original)
>> +++ trunk/res/res_odbc.c Wed Dec 17 15:46:19 2008
>> @@ -750,6 +750,7 @@
>>         }
>>  #endif
>>
>> +       ao2_ref(class, -1);
>>         return obj;
>>  }
> 
> I think we need a bit better discussion on this change.  If you read the
> code comments, it's very explicit that the outstanding reference to the class
> is INHERITED by the object, and if the object is destroyed, then the reference
> to the class is taken care of at that point.  Did you find an edge case where
> the class wasn't being dereferenced correctly, because in the general case,
> this change will cause the res_odbc code to shoot holes in memory.
> 

To be perfectly honest, I made the change based on the fact that every time I 
ran the 'queue show' command, the refcount for the class was increasing by one. 
If this is supposed to be happening, then feel free to revert it. I didn't glean 
from the comments that you were purposely not unreffing the class. I see the 
comment you are referring to, but I guess I didn't comprehend its meaning.

Mark Michelson



More information about the asterisk-dev mailing list