php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47414 PDO_Firebird memory leaks when using bindColumn()
Submitted: 2009-02-16 22:31 UTC Modified: 2016-12-07 16:26 UTC
Votes:6
Avg. Score:4.3 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:1 (20.0%)
From: felipe@php.net Assigned: mariuz (profile)
Status: Closed Package: PDO Firebird
PHP Version: 5.3CVS-2009-02-16 (CVS) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: felipe@php.net
New email:
PHP Version: OS:

 

 [2009-02-16 22:31 UTC] felipe@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 ===


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-20 19:40 UTC] 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();
}
 [2010-06-18 05:10 UTC] kalle@php.net
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
 [2011-12-11 17:32 UTC] mariuz@php.net
-Assigned To: +Assigned To: mariuz
 [2014-01-01 12:51 UTC] felipe@php.net
-Package: PDO related +Package: PDO Firebird
 [2016-12-06 17:19 UTC] dorin dot marcoci at gmail dot com
Just tested provided script on current master branch.
No memory leaks reported, all works just fine.
Does anyone still have this issue?
 [2016-12-06 17:41 UTC] mariuz@php.net
-Status: Assigned +Status: Closed
 [2016-12-06 17:52 UTC] mariuz@php.net
Seems that is solved , thanks for the report
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 17:01:31 2025 UTC