andrey                                   Tue, 25 May 2010 22:36:33 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299759

Log:
Use only memory that has been allocated

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c      2010-05-25 
22:34:47 UTC (rev 299758)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c      2010-05-25 
22:36:33 UTC (rev 299759)
@@ -885,13 +885,14 @@

        DBG_ENTER("mysqlnd_net_init");
        DBG_INF_FMT("persistent=%d", persistent);
-       net->persistent = persistent;
+       if (net) {
+               net->persistent = persistent;
+               net->m = mysqlnd_mysqlnd_net_methods;

-       net->m = mysqlnd_mysqlnd_net_methods;
-
-       {
-               unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this 
is long, cast to unsigned int*/
-               net->m.set_client_option(net, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, 
(char *) &buf_size TSRMLS_CC);
+               {
+                       unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); 
/* this is long, cast to unsigned int*/
+                       net->m.set_client_option(net, 
MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *) &buf_size TSRMLS_CC);
+               }
        }
        DBG_RETURN(net);
 }

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-05-25 22:34:47 UTC (rev 
299758)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-05-25 22:36:33 UTC (rev 
299759)
@@ -885,13 +885,14 @@

        DBG_ENTER("mysqlnd_net_init");
        DBG_INF_FMT("persistent=%d", persistent);
-       net->persistent = persistent;
+       if (net) {
+               net->persistent = persistent;
+               net->m = mysqlnd_mysqlnd_net_methods;

-       net->m = mysqlnd_mysqlnd_net_methods;
-
-       {
-               unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this 
is long, cast to unsigned int*/
-               net->m.set_client_option(net, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, 
(char *) &buf_size TSRMLS_CC);
+               {
+                       unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); 
/* this is long, cast to unsigned int*/
+                       net->m.set_client_option(net, 
MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *) &buf_size TSRMLS_CC);
+               }
        }
        DBG_RETURN(net);
 }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to