Edit report at http://bugs.php.net/bug.php?id=47414&edit=1

 ID:               47414
 Updated by:       ka...@php.net
 Reported by:      fel...@php.net
 Summary:          PDO_Firebird memory leaks when using bindColumn()
 Status:           Open
 Type:             Bug
 Package:          PDO related
 Operating System: *
 PHP Version:      5.3CVS-2009-02-16 (CVS)

 New Comment:

Looking thru the code, within firebird_statement.c there is a couple of
slprintf() calls, they are malloc()'d, and later efree()'s which I guess
could cause this


Previous Comments:
------------------------------------------------------------------------
[2009-02-20 19:40:53] cruzader at gmx dot de

Using: PHP 5.2.9RC2 (cli) (built: Feb 19 2009 16:29:53)

OS: OpenSuse 10.3



Description:

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

Any error with PDO will result in a memory leak. 



Reproduce code:

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

while (1) {

        $test = new PDO($db['dsn'], $db['username'], $db['password']);

        print "\n".memory_get_usage();

}

------------------------------------------------------------------------
[2009-02-16 22:31:07] fel...@php.net

Description:
------------
See below.

Reproduce code:
---------------
<?php



$db = new PDO('firebird:dbname=...', 'sysdba', 'foo');



$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);



@$db->exec('drop table test');

$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt
VARCHAR(20))');

$db->exec('INSERT INTO test VALUES(0, \'String0\')');



$stmt = $db->prepare('SELECT idx, txt FROM test ORDER by idx');



$idx = $txt = 0;



$stmt->bindColumn('IDX', $idx);

$stmt->bindColumn('TXT', $txt);

$stmt->execute();



while($stmt->fetch(PDO::FETCH_BOUND)) {

        var_dump(array($idx=>$txt));

}





Actual result:
--------------
array(1) {

  [0]=>

  string(7) "String0"

}

[Mon Feb 16 19:30:09 2009]  Script:  '../test.php'

/home/felipe/dev/php5/main/spprintf.c(775) :  Freeing 0x090E8A64 (79
bytes), script=../test.php

Last leak repeated 1 time

=== Total 2 memory leaks detected ===




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



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=47414&edit=1

Reply via email to