]> granicus.if.org Git - php/commitdiff
Use only memory that has been allocated
authorAndrey Hristov <andrey@php.net>
Tue, 25 May 2010 22:36:33 +0000 (22:36 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 25 May 2010 22:36:33 +0000 (22:36 +0000)
ext/mysqlnd/mysqlnd_net.c

index 5a3fda5e98b41c5d60e21cc464b2859994f12004..f1695066913c2de6b285738f2236e9b699266f20 100644 (file)
@@ -885,13 +885,14 @@ mysqlnd_net_init(zend_bool persistent TSRMLS_DC)
 
        DBG_ENTER("mysqlnd_net_init");
        DBG_INF_FMT("persistent=%d", persistent);
-       net->persistent = persistent;
-
-       net->m = mysqlnd_mysqlnd_net_methods;
+       if (net) {
+               net->persistent = persistent;
+               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);
 }