diff options
-rwxr-xr-x | ext/pdo/pdo_dbh.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 7752973010..7843f94dea 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -1337,6 +1337,8 @@ void pdo_dbh_init(TSRMLS_D) static void dbh_free(pdo_dbh_t *dbh TSRMLS_DC) { + int i; + if (--dbh->refcount) return; @@ -1357,8 +1359,11 @@ static void dbh_free(pdo_dbh_t *dbh TSRMLS_DC) if (dbh->def_stmt_ctor_args) { zval_ptr_dtor(&dbh->def_stmt_ctor_args); } - if (dbh->cls_methods) { - zend_hash_destroy(&dbh->cls_methods); + + for (i = 0; i < PDO_DBH_DRIVER_METHOD_KIND__MAX; i++) { + if (dbh->cls_methods[i]) { + zend_hash_destroy(dbh->cls_methods[i]); + } } pefree(dbh, dbh->is_persistent); |