summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2005-02-10 14:56:20 +0300
committerunknown <konstantin@mysql.com>2005-02-10 14:56:20 +0300
commitfca90750dfa0a2bee85a4824aba7c2197d45587c (patch)
tree73a3072c2493f8360a02575314c8fb19a5be032f /libmysql
parent425f2f91117c5cfa7d016130b0814a4bbde08274 (diff)
downloadmariadb-git-fca90750dfa0a2bee85a4824aba7c2197d45587c.tar.gz
A fix and test case for Bug#8330 "mysql_stmt_execute crashes" (libmysql).
libmysql/libmysql.c: Fix for bug#8330 "mysql_stmt_execute crashes": we need to bail out from mysql_stmt_execute if mysql->net is occupied with a result set of another statement. Otherwise on the next attempt to use net we get a crash, as it's freed in case of error. tests/mysql_client_test.c: A test case for Bug#8330 "mysql_stmt_execute craches" (libmysql)
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/libmysql.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 3d84059e981..24a7fa5f929 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -2467,6 +2467,11 @@ int cli_stmt_execute(MYSQL_STMT *stmt)
set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate);
DBUG_RETURN(1);
}
+ if (stmt->mysql->status != MYSQL_STATUS_READY)
+ {
+ set_stmt_error(stmt, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
+ DBUG_RETURN(1);
+ }
net_clear(net); /* Sets net->write_pos */
/* Reserve place for null-marker bytes */