From 7b6fc96d7710b1467420a548a7ae7b1e9b7b56fa Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 20 Apr 2012 11:09:02 +0200 Subject: fixed some nasty bugs --- pool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pool.c') diff --git a/pool.c b/pool.c index 5ad56c5..7f85ae7 100644 --- a/pool.c +++ b/pool.c @@ -109,6 +109,7 @@ int psql_pool_destroy( PgConnPool *pool ) } free( pool->conns ); + free( pool->avail ); res1 = pthread_cond_destroy( &pool->cond ); res2 = pthread_mutex_destroy( &pool->lock ); @@ -166,7 +167,7 @@ int psql_pool_release( PgConnPool *pool, PGconn *conn ) res = pthread_mutex_lock( &pool->lock ); if( res < 0 ) return res; - for( i = pool->size; i >= 0; i-- ) { + for( i = pool->size-1; i >= 0; i-- ) { if( pool->conns[i] == conn ) { break; } -- cgit v1.2.3-54-g00ecf