From: Ilia Alshanetsky Date: Mon, 7 Aug 2006 17:32:13 +0000 (+0000) Subject: Fixed memory leak with persistent connections X-Git-Tag: php-5.2.0RC2~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=194b309d2d2e49636dcb9bcc9c57b4b700a47ab3;p=php Fixed memory leak with persistent connections --- diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index e98188fb14..2b0596fd63 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -342,7 +342,9 @@ static PHP_METHOD(PDO, dbh_constructor) /* switch over to the persistent one */ dbh = pdbh; zend_object_store_set_object(object, dbh TSRMLS_CC); - dbh->refcount++; + if (!call_factory) { + dbh->refcount++; + } } if (hashkey) { @@ -1399,6 +1401,10 @@ static void dbh_free(pdo_dbh_t *dbh TSRMLS_DC) pefree(dbh->password, dbh->is_persistent); } + if (dbh->persistent_id) { + pefree((char *)dbh->persistent_id, dbh->is_persistent); + } + if (dbh->def_stmt_ctor_args) { zval_ptr_dtor(&dbh->def_stmt_ctor_args); }