georg Mon Dec 27 10:40:40 2004 EDT Modified files: (Branch: PHP_5_0) /php-src/ext/mysqli mysqli_api.c /php-src/ext/mysqli/tests 047.phpt Log: fixed possible leak in mysqli_init fixed testcase 047.phpt http://cvs.php.net/diff.php/php-src/ext/mysqli/mysqli_api.c?r1=1.87.2.7&r2=1.87.2.8&ty=u Index: php-src/ext/mysqli/mysqli_api.c diff -u php-src/ext/mysqli/mysqli_api.c:1.87.2.7 php-src/ext/mysqli/mysqli_api.c:1.87.2.8 --- php-src/ext/mysqli/mysqli_api.c:1.87.2.7 Mon Dec 27 06:52:08 2004 +++ php-src/ext/mysqli/mysqli_api.c Mon Dec 27 10:40:40 2004 @@ -15,7 +15,7 @@ | Author: Georg Richter <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ - $Id: mysqli_api.c,v 1.87.2.7 2004/12/27 11:52:08 georg Exp $ + $Id: mysqli_api.c,v 1.87.2.8 2004/12/27 15:40:40 georg Exp $ */ #ifdef HAVE_CONFIG_H @@ -983,14 +983,15 @@ Initialize mysqli and return a resource for use with mysql_real_connect */ PHP_FUNCTION(mysqli_init) { + MYSQLI_RESOURCE *mysqli_resource; MY_MYSQL *mysql = (MY_MYSQL *)calloc(1, sizeof(MY_MYSQL)); - MYSQLI_RESOURCE *mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); - if (!(mysql->mysql = mysql_init(NULL))) { efree(mysql); RETURN_FALSE; } + + mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE)); mysqli_resource->ptr = (void *)mysql; MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry); } http://cvs.php.net/diff.php/php-src/ext/mysqli/tests/047.phpt?r1=1.4.2.1&r2=1.4.2.2&ty=u Index: php-src/ext/mysqli/tests/047.phpt diff -u php-src/ext/mysqli/tests/047.phpt:1.4.2.1 php-src/ext/mysqli/tests/047.phpt:1.4.2.2 --- php-src/ext/mysqli/tests/047.phpt:1.4.2.1 Sat Dec 4 04:01:34 2004 +++ php-src/ext/mysqli/tests/047.phpt Mon Dec 27 10:40:40 2004 @@ -12,7 +12,7 @@ mysqli_select_db($link, "test"); mysqli_query($link, "DROP TABLE IF EXISTS test_affected"); - mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10))"); + mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10) character set latin1)"); mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')"); @@ -31,7 +31,7 @@ --EXPECTF-- array(2) { [0]=> - object(stdClass)#%d (9) { + object(stdClass)#4 (11) { ["name"]=> string(3) "foo" ["orgname"]=> @@ -44,6 +44,10 @@ string(0) "" ["max_length"]=> int(0) + ["length"]=> + int(11) + ["charsetnr"]=> + int(63) ["flags"]=> int(32768) ["type"]=> @@ -52,7 +56,7 @@ int(0) } [1]=> - object(stdClass)#%d (9) { + object(stdClass)#5 (11) { ["name"]=> string(3) "bar" ["orgname"]=> @@ -65,6 +69,10 @@ string(0) "" ["max_length"]=> int(0) + ["length"]=> + int(10) + ["charsetnr"]=> + int(8) ["flags"]=> int(0) ["type"]=>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php