php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40889 Coll->assignElem(n,"str") and Coll->append("str") causes memory leak
Submitted: 2007-03-22 09:01 UTC Modified: 2007-03-30 01:00 UTC
From: uno at venus dot dti dot ne dot jp Assigned:
Status: No Feedback Package: OCI8 related
PHP Version: 4.4.6 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 + 39 = ?
Subscribe to this entry?

 
 [2007-03-22 09:01 UTC] uno at venus dot dti dot ne dot jp
Description:
------------
I found that
coll->append("string");
or
coll->assignElem(n,"string");
cause memory leak.

You need to free OCIAssignText()'ed strings with OCIStringResize() in oci8.c (PHP 4.4.6) and oci8_collection.c (PHP 5.2.1, PECL/oci8-1.2.3) because OCICollAppend() and OCICollAssignElem() perform deep-copy of element value.

see:
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14250/oci18map001.htm#i448982
http://download-east.oracle.com/docs/cd/A58617_01/server.804/a58234/orl_func.htm#426353


Reproduce code:
---------------
$collStr = ocinewcollection( ... );
$collStr->append("string");              /* memory leak */
$collStr->assignElem(0,"string");        /* memory leak */

$collNum = ocinewcollection( ... );
$collNum->append(1234);                  /* no memory leak */
$collNum->assignElem(0, 5678);           /* no memory leak */

$collDate = ocinewcollection( ... );
$collDate->append("2007-01-01");         /* no memory leak */
$collDate->assignElem(0, "2007-02-02");  /* no memory leak */



Expected result:
----------------
no memory leak


Actual result:
--------------
memory leak


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-22 10:26 UTC] tony2001@php.net
Are you using OCI8 from PECL?
If yes, which version?
 [2007-03-30 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 17:01:29 2024 UTC