apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r683845 - /apr/apr-util/branches/1.3.x/include/apr_reslist.h
Date Fri, 08 Aug 2008 04:33:28 GMT
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,



Mime
View raw message