* Operating environment
     OS:RHEL54 10.33.140.105
        httpd-2.2.3-31.el5

* Step to Reproduce

1) Create a cgi file.
     - /var/www/cgi-bin/test.cgi(permission is 755)
       ---------------------------------------------------
       #!/bin/sh
       
       #SLEEP_TIME=30
       SLEEP_TIME=10
       
       echo "Content-type: text/html"
       echo ""
       echo "<html><body><H1>sleep start<H1>"
       sleep $SLEEP_TIME
       echo "<H1>sleep end<H1></body></html>"
       ---------------------------------------------------

2) Configurate the httpd.conf.
       # vi /etc/httpd/conf/httpd.conf
       ---------------------------------------------------
       ServerLimit      4096
       MaxClients       4096
       #ServerLimit      256
       #MaxClients       256

                       :
       LoadModule authn_dbd_module modules/mod_authn_dbd.so
       LoadModule dbd_module modules/mod_dbd.so
                       :
       DBDriver pgsql
       #DBDParams "host=localhost dbname=wwwdb user=micweb2 password=micweb2"
       DBDParams "dbname=wwwdb user=micweb2"
       DBDMin 1
       DBDKeep 2
       DBDMax 10
       DBDExptime 60
                       :
       <Directory "/var/www/cgi-bin">
           Options ExecCGI
           AllowOverride None
           Options None
           Order allow,deny
           Allow from all
       </Directory>

       ---------------------------------------------------

3) Start the postgresql.
       # service postgresql start
       Initializing database:                                     [  OK  ]
       Starting postgresql service:                               [  OK  ]
       # 

4) Change the user to "postgres".
       # grep postgres /etc/passwd
       postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
       # su - postgres
       -bash-3.2$ 

5) Create a DB.
       -bash-3.2$ createdb wwwdb
       CREATE DATABASE
       -bash-3.2$ 

5-1) Create a user.
       -bash-3.2$ psql
       postgres=# CREATE USER micweb2 PASSWORD 'micweb2' ;
       CREATE ROLE
       postgres=# select * from pg_user;
        usename  | usesysid | usecreatedb | usesuper | usecatupd |  passwd  | valuntil | useconfig 
       ----------+----------+-------------+----------+-----------+----------+----------+-----------
        postgres |       10 | t           | t        | t         | ******** |          | 
        micweb2  |    16387 | f           | f        | f         | ******** |          | 
       (2 rows)

       postgres=# 

5-2) Create a table.
       postgres=# \q
       -bash-3.2$ psql wwwdb
       Welcome to psql 8.1.11, the PostgreSQL interactive terminal.

       Type:  \copyright for distribution terms
              \h for help with SQL commands
              \? for help with psql commands
              \g or terminate with semicolon to execute query
              \q to quit

       wwwdb=# CREATE TABLE auth_user (
       wwwdb(#    userid   varchar(80),
       wwwdb(#    password varchar(80),
       wwwdb(#    used     int
       wwwdb(# );
       CREATE TABLE
       wwwdb=# 

6) Create a data.
       wwwdb=#  INSERT INTO auth_user VALUES ( 'wata', 'wata', 0 );
       INSERT 0 1
       wwwdb=#  INSERT INTO auth_user VALUES ( 'aki', 'aki', 0 );
       INSERT 0 1
       wwwdb=# SELECT password FROM auth_user WHERE userid= 'wata' and used != 1 ;
        password
       ----------
        wata
       (1 rows)

       wwwdb=# 

7) Configurate the pg_hda.conf.
       # vi /var/lib/pgsql/data/pg_hba.conf 
       ---------------------------------------------------
       # "local" is for Unix domain socket connections only
       #local   all         all                               ident sameuser
       local   all         all                               trust
       ---------------------------------------------------
       o "ident sameuser" was changed to "trust".

8) Change the access authority of "Authuser table".

8-1) Change the user to "postgres".
       # grep postgres /etc/passwd
       postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
       # su - postgres
       -bash-3.2$ 

8-2) Change the access authority of "Authuser table".
       -bash-3.2$ psql wwwdb
       Welcome to psql 8.1.11, the PostgreSQL interactive terminal.

       Type:  \copyright for distribution terms
              \h for help with SQL commands
              \? for help with psql commands
              \g or terminate with semicolon to execute query
              \q to quit

       wwwdb=# grant select on auth_user to micweb2;
       GRANT
       wwwdb=# 

9) Create a test script.
     - get.sh
       ---------------------------------------------------
       #!/bin/sh

       mkdir /tmp/work 2>&1
       count=1
       count2=1
       maxcount=1000

       while :;
       do
         count=`printf "%04d\n" $count2`
         echo "$count"
         wget http://10.33.140.105/cgi-bin/test.cgi > /dev/null 2>&1 &

         if [ $count2 -eq $maxcount ] ; then
            break;
         fi
         count2=`expr $count2 + 1`
       done
       ---------------------------------------------------

10) Run the test script.
       # sh get.sh
           :

<The problem is reproduced>
     - /var/log/httpd/error_log
       ---------------------------------------------------
       *** glibc detected *** /usr/sbin/httpd: double free or corruption (!prev): 0x00002af61e16b380 ***
       ======= Backtrace: =========
       /lib64/libc.so.6[0x2af6088f12ef]
                  :
       [Wed Sep 08 14:30:25 2010] [notice] child pid 21307 exit signal Aborted (6)
                  :
       ---------------------------------------------------

The files we used are below. 

 - reproduction_report.tar.gz
      - /var/www/cgi-bin/test.cgi
      - /etc/httpd/conf/httpd.conf
      - get.sh