]> granicus.if.org Git - php/commitdiff
MFB: Fixed memory leak with persistent connections
authorIlia Alshanetsky <iliaa@php.net>
Mon, 7 Aug 2006 17:33:20 +0000 (17:33 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 7 Aug 2006 17:33:20 +0000 (17:33 +0000)
ext/pdo/pdo_dbh.c

index 9c8bb059ce08cf68ee77310ed14090a3d0fd3496..b0b1c2fd6c557a4caf3962970de224c26d5d9d85 100755 (executable)
@@ -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) {
@@ -1378,6 +1380,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);
        }