php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46109 MySQLi::init - Memory leaks
Submitted: 2008-09-17 17:54 UTC Modified: 2008-09-19 11:40 UTC
From: felipe@php.net Assigned: andrey
Status: Closed Package: MySQLi related
PHP Version: 5.3CVS-2008-09-17 (CVS) OS:
Private report: No CVE-ID:
 [2008-09-17 17:54 UTC] felipe@php.net
Description:
------------
Calling init() two or more times generates the mem. leak.

Reproduce code:
---------------
<?php

$x = new mysqli;
$x->init();
$x->init();

Actual result:
--------------
==19445== 988 (12 direct, 976 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 7
==19445==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==19445==    by 0x83A4EB8: _ecalloc (zend_alloc.c:2414)
==19445==    by 0x816F4A1: zif_mysqli_init (mysqli_api.c:1330)
==19445==    by 0x83FB4DF: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:315)
==19445==    by 0x83E9602: execute (zend_vm_execute.h:104)
==19445==    by 0x83C3A6E: zend_execute_scripts (zend.c:1197)
==19445==    by 0x836916C: php_execute_script (main.c:2080)
==19445==    by 0x845B734: main (php_cli.c:1130)
==19445== 
==19445== 
==19445== 952 bytes in 1 blocks are indirectly lost in loss record 6 of 7
==19445==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==19445==    by 0x4F3D31C: my_malloc (in /usr/lib/libmysqlclient_r.so.15.0.0)
==19445==    by 0x4F6325E: mysql_init (in /usr/lib/libmysqlclient_r.so.15.0.0)
==19445==    by 0x816F483: zif_mysqli_init (mysqli_api.c:1317)
==19445==    by 0x83FB4DF: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:315)
==19445==    by 0x83E9602: execute (zend_vm_execute.h:104)
==19445==    by 0x83C3A6E: zend_execute_scripts (zend.c:1197)
==19445==    by 0x836916C: php_execute_script (main.c:2080)
==19445==    by 0x845B734: main (php_cli.c:1130)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-19 11:40 UTC] andrey@php.net
This bug has been fixed in CVS.

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

Thanks for heads up!
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 18:01:53 2014 UTC