com php-src: Fix bug #73949 leak in mysqli_fetch_object: NEWS ext/mysqli/mysqli.c ext/mysqli/tests/bug739 49.phpt
| From: | Joe Watkins | Date: | Wed, 18 Jan 2017 18:22:57 +0000 |
| Subject: | com php-src: Fix bug #73949 leak in mysqli_fetch_object: NEWS ext/mysqli/mysqli.c ext/mysqli/tests/bug739 49.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96798@lists.php.net to get a copy of this message | ||
Commit: f9226f9bf34233cd6c1fee247c02c6a96d9ef754
Author: Joe Watkins <krakjoe@php.net> Wed, 18 Jan 2017 18:22:57 +0000
Parents: fb8486f3bdd84d92da7c05e6e3c226df71c574da
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f9226f9bf34233cd6c1fee247c02c6a96d9ef754
Log:
Fix bug #73949 leak in mysqli_fetch_object
Bugs:
https://bugs.php.net/73949
Changed paths:
M NEWS
M ext/mysqli/mysqli.c
A ext/mysqli/tests/bug73949..phpt
Diff:
diff --git a/NEWS b/NEWS
index 1a741d1..a67c069 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ PHP NEWS
. Fixed bug #73933 (error/segfault with ldap_mod_replace and opcache).
(Laruence)
+- MySQLi:
+ . Fixed bug #73949 (leak in mysqli_fetch_object). (krakjoe)
+
- Mysqlnd:
. Fixed bug #69899 (segfault on close() after free_result() with mysqlnd).
(Richard Fussenegger)
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index fa55627..481b46c 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -1324,9 +1324,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int
override_flags
} else {
zval_ptr_dtor(&retval);
}
- if (fci.params) {
- efree(fci.params);
- }
+ zend_fcall_info_args_clear(&fci, 1);
} else if (ctor_params) {
zend_throw_exception_ex(zend_ce_exception, 0, "Class %s does not have a constructor hence
you cannot use ctor_params", ZSTR_VAL(ce->name));
}
diff --git a/ext/mysqli/tests/bug73949.phpt b/ext/mysqli/tests/bug73949.phpt
new file mode 100644
index 0000000..7ce311e
--- /dev/null
+++ b/ext/mysqli/tests/bug73949.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #73949 (leak in mysqli_fetch_object)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+require_once("connect.inc");
+
+class cc{
+ function __construct($c=null){
+ }
+};
+$i=mysqli_connect('p:'.$host, $user, $passwd, $db);
+$res=mysqli_query($i, "SHOW STATUS LIKE 'Connections'");
+$t=array(new stdClass);
+while($db= mysqli_fetch_object($res,'cc',$t)){}
+print "done!";
+?>
+--EXPECTF--
+done!