From:             uno at venus dot dti dot ne dot jp
Operating system: Linux
PHP version:      4.4.6
PHP Bug Type:     OCI8 related
Bug description:  Coll->assignElem(n,"str") and Coll->append("str") causes 
memory leak

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


-- 
Edit bug report at http://bugs.php.net/?id=40889&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40889&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40889&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40889&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40889&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40889&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40889&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40889&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40889&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40889&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40889&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40889&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40889&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40889&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40889&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40889&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40889&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40889&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40889&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40889&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40889&r=mysqlcfg

Reply via email to