You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@attglobal.net> on 2002/01/10 19:39:02 UTC
[PATCH] necessary fix to APR_POOL_DEBUG?
While trying to run with APR_POOL_DEBUG I hit a segfault almost
immediately trying to dereference pool->mutex, which wasn't a valid
pointer. I see a path where pool->mutex isn't initialized. This
seems to fix it, though perhaps one of the pool guys wants to just set
the mutex field?
Index: srclib/apr/memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.126
diff -u -r1.126 apr_pools.c
--- srclib/apr/memory/unix/apr_pools.c 1 Jan 2002 23:49:23 -0000 1.126
+++ srclib/apr/memory/unix/apr_pools.c 10 Jan 2002 18:38:57 -0000
@@ -1,3 +1,4 @@
+#define APR_POOL_DEBUG
/* ====================================================================
* The Apache Software License, Version 1.1
*
@@ -982,6 +983,8 @@
return APR_ENOMEM;
}
+
+ memset(pool, 0, SIZEOF_POOL_T);
pool->abort_fn = abort_fn;
pool->child = NULL;
--
Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...
RE: [PATCH] necessary fix to APR_POOL_DEBUG?
Posted by Sander Striker <st...@apache.org>.
Hi,
Yeah, looks about right. Thanks.
I took it a step further and eliminated the explicit
NULL after the memset. Fixed an unprotected pool->mutex
instance aswell.
Sander
> -----Original Message-----
> From: trawick@rdu163-40-092.nc.rr.com
> [mailto:trawick@rdu163-40-092.nc.rr.com]On Behalf Of Jeff Trawick
> Sent: 10 January 2002 19:39
> To: dev@apr.apache.org
> Subject: [PATCH] necessary fix to APR_POOL_DEBUG?
>
>
> While trying to run with APR_POOL_DEBUG I hit a segfault almost
> immediately trying to dereference pool->mutex, which wasn't a valid
> pointer. I see a path where pool->mutex isn't initialized. This
> seems to fix it, though perhaps one of the pool guys wants to just set
> the mutex field?
>
> Index: srclib/apr/memory/unix/apr_pools.c
> ===================================================================
> RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
> retrieving revision 1.126
> diff -u -r1.126 apr_pools.c
> --- srclib/apr/memory/unix/apr_pools.c 1 Jan 2002 23:49:23 -0000 1.126
> +++ srclib/apr/memory/unix/apr_pools.c 10 Jan 2002 18:38:57 -0000
> @@ -1,3 +1,4 @@
> +#define APR_POOL_DEBUG
> /* ====================================================================
> * The Apache Software License, Version 1.1
> *
> @@ -982,6 +983,8 @@
>
> return APR_ENOMEM;
> }
> +
> + memset(pool, 0, SIZEOF_POOL_T);
>
> pool->abort_fn = abort_fn;
> pool->child = NULL;
>
> --
> Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
> http://www.geocities.com/SiliconValley/Park/9289/
> Born in Roswell... married an alien...
>
>