diff options
-rw-r--r-- | sql-common/client.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index cd9b6a71c53..3a6e205d384 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3790,12 +3790,15 @@ static void mysql_close_free(MYSQL *mysql) */ static void mysql_prune_stmt_list(MYSQL *mysql) { - LIST *element= mysql->stmts; LIST *pruned_list= 0; - for (; element; element= element->next) + while(mysql->stmts) { - MYSQL_STMT *stmt= (MYSQL_STMT *) element->data; + LIST *element= mysql->stmts; + MYSQL_STMT *stmt; + + mysql->stmts= list_delete(element, element); + stmt= (MYSQL_STMT *) element->data; if (stmt->state != MYSQL_STMT_INIT_DONE) { stmt->mysql= 0; |