]> granicus.if.org Git - php/commitdiff
Fix double calls to free_contents if the connection cannot be
authorAndrey Hristov <andrey@php.net>
Tue, 22 Dec 2009 17:44:42 +0000 (17:44 +0000)
committerAndrey Hristov <andrey@php.net>
Tue, 22 Dec 2009 17:44:42 +0000 (17:44 +0000)
opened. mysqlnd have no probs, external code should not have too.
In any case, double call is not needed.

ext/mysqlnd/mysqlnd.c

index ab24f0293b94f2cd0ed5c744aef754c4fea7466c..e76d9ab05ec2f956e069d65302a5cfb6b22357aa 100644 (file)
@@ -737,8 +737,6 @@ err:
                conn->scheme = NULL;
        }
 
-       /* This will also close conn->net->stream if it has been opened */
-       conn->m->free_contents(conn TSRMLS_CC);
        MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_FAILURE);
 
        DBG_RETURN(FAIL);
@@ -776,6 +774,9 @@ PHPAPI MYSQLND * mysqlnd_connect(MYSQLND * conn,
                          object - we are free to kill it!
                        */
                        conn->m->dtor(conn TSRMLS_CC);
+               } else {
+                       /* This will also close conn->net->stream if it has been opened */
+                       conn->m->free_contents(conn TSRMLS_CC);
                }
                DBG_RETURN(NULL);
        }