andrey Mon Feb 4 17:55:06 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mysqlnd mysqlnd.c Log: Simplify unique string generation and plug a leak. http://cvs.php.net/viewvc.cgi/php-src/ext/mysqlnd/mysqlnd.c?r1=1.5.2.13&r2=1.5.2.14&diff_format=u Index: php-src/ext/mysqlnd/mysqlnd.c diff -u php-src/ext/mysqlnd/mysqlnd.c:1.5.2.13 php-src/ext/mysqlnd/mysqlnd.c:1.5.2.14 --- php-src/ext/mysqlnd/mysqlnd.c:1.5.2.13 Tue Jan 29 18:11:46 2008 +++ php-src/ext/mysqlnd/mysqlnd.c Mon Feb 4 17:55:06 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mysqlnd.c,v 1.5.2.13 2008/01/29 18:11:46 andrey Exp $ */ +/* $Id: mysqlnd.c,v 1.5.2.14 2008/02/04 17:55:06 andrey Exp $ */ #include "php.h" #include "mysqlnd.h" #include "mysqlnd_wireprotocol.h" @@ -28,8 +28,6 @@ #include "mysqlnd_charset.h" #include "mysqlnd_debug.h" #include "mysqlnd_block_alloc.h" -#include "ext/standard/basic_functions.h" -#include "ext/standard/php_lcg.h" /* the server doesn't support 4byte utf8, but let's make it forward compatible */ #define MYSQLND_MAX_ALLOWED_USER_LEN 256 /* 64 char * 4byte */ @@ -544,15 +542,6 @@ } DBG_INF_FMT("transport=%p", transport); - if (conn->persistent) { - struct timeval tv; - gettimeofday(&tv, NULL); - /* We should generate something unique */ - hashed_details_len = spprintf(&hashed_details, 0, "[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]", - transport, user, db, tv.tv_sec, (long int)tv.tv_usec, - php_combined_lcg(TSRMLS_C) * 10); - DBG_INF_FMT("hashed_details=%s", hashed_details); - } PACKET_INIT_ALLOCA(greet_packet, PROT_GREET_PACKET); PACKET_INIT(auth_packet, PROT_AUTH_PACKET, php_mysql_packet_auth *); @@ -563,6 +552,19 @@ self_alloced = TRUE; } + if (conn->persistent) { +#if 0 + struct timeval tv; + gettimeofday(&tv, NULL); + /* We should generate something unique */ + hashed_details_len = spprintf(&hashed_details, 0, "[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]", + transport, user, db, tv.tv_sec, (long int)tv.tv_usec, + php_combined_lcg(TSRMLS_C) * 10); +#endif + hashed_details_len = spprintf(&hashed_details, 0, "%p", conn); + DBG_INF_FMT("hashed_details=%s", hashed_details); + } + CONN_SET_STATE(conn, CONN_ALLOCED); conn->net.packet_no = 0; @@ -584,6 +586,9 @@ DBG_INF_FMT("stream=%p", conn->net.stream); if (errstr || !conn->net.stream) { + if (hashed_details) { + mnd_efree(hashed_details); + } goto err; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php