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

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Wed Dec 17 18:02:41 CST 2008


> 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.

-- 
Tilghman



More information about the asterisk-dev mailing list