Bug #73949 [Asn->Csd]: memory leaks detected

From: Date: Wed, 18 Jan 2017 18:25:18 +0000
Subject: Bug #73949 [Asn->Csd]: memory leaks detected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206729@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73949&edit=1 ID: 73949 Updated by: krakjoe@php.net Reported by: shan dot liu at msn dot com Summary: memory leaks detected -Status: Assigned +Status: Closed Type: Bug Package: MySQLi related PHP Version: 7.1.0 Assigned To: krakjoe Block user comment: N Private report: N New Comment: Automatic comment on behalf of krakjoe Revision: http://git.php.net/?p=php-src.git;a=commit;h=f9226f9bf34233cd6c1fee247c02c6a96d9ef754 Log: Fix bug #73949 leak in mysqli_fetch_object Previous Comments: ------------------------------------------------------------------------ [2017-01-17 02:10:14] shan dot liu at msn dot com mysqli.c line 1294: if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be * by mistake and the other way round is possible, too. The * single value is an array. Also we'd have to make that one * argument passed by reference. */ zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0); return; } } change to: if (ctor_params && Z_TYPE_P(ctor_params) != IS_NULL) { if (zend_fcall_info_args(&fci, ctor_params) == FAILURE) { /* Two problems why we throw exceptions here: PHP is typeless * and hence passing one argument that's not an array could be * by mistake and the other way round is possible, too. The * single value is an array. Also we'd have to make that one * argument passed by reference. */ zend_throw_exception(zend_ce_exception, "Parameter ctor_params must be an array", 0); return; } zend_refcounted *_gc = Z_COUNTED_P(fci.params); GC_REFCOUNT(_gc)--; } ------------------------------------------------------------------------ [2017-01-16 16:22:10] shan dot liu at msn dot com Description: ------------ [Tue Jan 17 00:15:57 2017] Script: '/home/lonely/workspace/ldb/dome/t.php' /opt/php7/src/Zend/zend_string.h(0) : Freeing 0x7FA2B387B2C0 (32 bytes), script=/home/lonely/workspace/ldb/dome/t.php === Total 1 memory leaks detected === Test script: --------------- <?php class cc{ function __construct($c=null){ } }; $i=mysqli_connect("127.0.0.1",'root','110','test_db'); $res=mysqli_query($i,'select * from l_order limit 1'); $t=array('-'); while($db= mysqli_fetch_object($res,'cc',$t)){} ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73949&edit=1

« previous php.bugs (#206729) next »