]> granicus.if.org Git - php/commitdiff
avoid unterminated loop when closing the statement.
authorWez Furlong <wez@php.net>
Sat, 22 Apr 2006 16:35:18 +0000 (16:35 +0000)
committerWez Furlong <wez@php.net>
Sat, 22 Apr 2006 16:35:18 +0000 (16:35 +0000)
ext/pdo_mysql/mysql_statement.c

index 4d7754a7e28e76294f5fa9e022cbd08989974b7a..920702b3c9dcecdb52e8f7199f1144d898af72cb 100755 (executable)
@@ -69,11 +69,14 @@ static int pdo_mysql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
 #endif
 #if HAVE_MYSQL_NEXT_RESULT
        while (mysql_more_results(S->H->server)) {
-               if (mysql_next_result(S->H->server) == 0) {
-                       MYSQL_RES *res = mysql_store_result(S->H->server);
-                       if (res) {
-                               mysql_free_result(res);
-                       }
+               MYSQL_RES *res;
+               if (mysql_next_result(S->H->server) != 0) {
+                       break;
+               }
+                       
+               res = mysql_store_result(S->H->server);
+               if (res) {
+                       mysql_free_result(res);
                }
        }
 #endif
@@ -602,11 +605,13 @@ static int pdo_mysql_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
        }
 #if HAVE_MYSQL_NEXT_RESULT
        while (mysql_more_results(S->H->server)) {
-               if (mysql_next_result(S->H->server) == 0) {
-                       MYSQL_RES *res = mysql_store_result(S->H->server);
-                       if (res) {
-                               mysql_free_result(res);
-                       }
+               MYSQL_RES *res;
+               if (mysql_next_result(S->H->server) != 0) {
+                       break;
+               }
+               res = mysql_store_result(S->H->server);
+               if (res) {
+                       mysql_free_result(res);
                }
        }
 #endif