|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50162 Memory leak when fetching timestamp column from Oracle database
Submitted: 2009-11-13 04:33 UTC Modified: 2009-12-06 18:55 UTC
From: shigeru_kitazaki at cybozu dot co dot jp Assigned: felipe
Status: Closed Package: ODBC related
PHP Version: 5.3.0 OS: Linux
Private report: No CVE-ID:
 [2009-11-13 04:33 UTC] shigeru_kitazaki at cybozu dot co dot jp
PHP (debug build) detects memory leaks on this environment.
 - Linux Cent OS 5.3 (64bit)
 - unixODBC-2.2.15pre
 - Oracle instantclient 11.1

This occurs only when fetching Oracle "TIMESTANP" column on Linux.

Reproduce code:
$user = "VALID_USER_NAME";
$conn = odbc_connect($dsn, $user, $pass);

// sample table has this schema and has more than one row(s).
$ret = odbc_exec($conn, "SELECT COLUMN1 FROM TEST");

// Here detects leaking memory!! And, data seems normal state.
$data = odbc_result($ret, 1);


Actual result:
string(26) "2009-11-13 00:00:00.000000"
[Fri Nov 13 13:06:27 2009]  Script:  '/home/cybozu/oracle_timestamp.php'
/home/cybozu/tmp/php/ext/odbc/php_odbc.c(429) : Block 0x04ae49a8 status:
Beginning:      OK (allocated on /home/cybozu/tmp/php/ext/odbc/php_odbc.c:984, 27 bytes)
    Start:      OK
      End:      Overflown (magic=0x00000030 instead of 0x6C71D1A1)
                3 byte(s) overflown
[Fri Nov 13 13:06:27 2009]  Script:  '/home/cybozu/oracle_timestamp.php'
/home/cybozu/tmp/php/ext/odbc/php_odbc.c(984) :  Freeing 0x04AE49A8 (27 bytes), script=/home/cybozu/oracle_timestamp.php
=== Total 1 memory leaks detected ===


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-06 18:53 UTC]
Automatic comment from SVN on behalf of felipe
Log: - Fixed bug #50162 (Memory leak when fetching timestamp column from Oracle database)
- Fixed bug #34852 (Failure in odbc_exec() using oracle-supplied odbc driver) (patch by tim dot tassonis at trivadis dot com)
 [2009-12-06 18:55 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

This is an Oracle odbc driver issue, look:

However I added a workaround for this issue.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 23:01:32 2015 UTC