You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2008/08/08 06:33:28 UTC

svn commit: r683845 - /apr/apr-util/branches/1.3.x/include/apr_reslist.h

Author: bojan
Date: Thu Aug  7 21:33:28 2008
New Revision: 683845

URL: http://svn.apache.org/viewvc?rev=683845&view=rev
Log:
Warn reslist users of potential dangers related to sub-pool creation.

Modified:
    apr/apr-util/branches/1.3.x/include/apr_reslist.h

Modified: apr/apr-util/branches/1.3.x/include/apr_reslist.h
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.3.x/include/apr_reslist.h?rev=683845&r1=683844&r2=683845&view=diff
==============================================================================
--- apr/apr-util/branches/1.3.x/include/apr_reslist.h (original)
+++ apr/apr-util/branches/1.3.x/include/apr_reslist.h Thu Aug  7 21:33:28 2008
@@ -81,6 +81,15 @@
  * @param pool The pool from which to create this resoure list. Also the
  *             same pool that is passed to the constructor and destructor
  *             routines.
+ * @warning If you're creating a sub-pool of the pool passed into this
+ *          function in your constructor, you will need to follow some rules
+ *          when it comes to destruction of that sub-pool, as calling
+ *          apr_pool_destroy() outright on it in your destructor may create
+ *          double free situations. That is because by the time destructor is
+ *          called, the sub-pool may have already been destroyed.  This also
+ *          means that in the destructor, memory from the sub-pool should be
+ *          treated as invalid. For examples of how to do this correctly, see
+ *          mod_dbd of Apache 2.2 and memcache support in APR Util 1.3.
  */
 APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist,
                                              int min, int smax, int hmax,



Re: svn commit: r683845 - /apr/apr-util/branches/1.3.x/include/apr_reslist.h

Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2008-08-08 at 04:33 +0000, bojan@apache.org wrote:

> Warn reslist users of potential dangers related to sub-pool creation.

I did this for 1.3.x only on purpose. Trunk should probably get a
different comment.

-- 
Bojan