php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73949 memory leaks detected
Submitted: 2017-01-16 16:22 UTC Modified: 2017-01-18 18:05 UTC
From: shan dot liu at msn dot com Assigned: krakjoe (profile)
Status: Closed Package: MySQLi related
PHP Version: 7.1.0 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shan dot liu at msn dot com
New email:
PHP Version: OS:

 

 [2017-01-16 16:22 UTC] 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)){}




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-17 02:10 UTC] 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-18 18:05 UTC] krakjoe@php.net
-Assigned To: +Assigned To: krakjoe
 [2017-01-18 18:25 UTC] krakjoe@php.net
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
 [2017-01-18 18:25 UTC] krakjoe@php.net
-Status: Assigned +Status: Closed
 [2017-02-01 13:08 UTC] spam2 at rhsoft dot net
may someone look also at https://bugs.php.net/bug.php?id=73889
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC