summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2004-05-17 01:52:13 +0300
committermonty@mysql.com <>2004-05-17 01:52:13 +0300
commitcd3dab49cc4f3b227b65419a5f12f66c4e0a76a0 (patch)
treeb9fa88577b516df5fb27de3970ec9eab9aaef532 /sql/sql_parse.cc
parenta79a3f5724cb577a37f3337ca7ae429b6dc56e9c (diff)
parent1e860400f3a260c01a00bada514df7f34ec462c0 (diff)
downloadmariadb-git-cd3dab49cc4f3b227b65419a5f12f66c4e0a76a0.tar.gz
Merge with 4.0.20
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e949d40625d..f2458068633 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1475,9 +1475,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
packet++;
length--;
}
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_length= length;
thd->query= packet;
- VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id= query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
#ifndef EMBEDDED_LIBRARY
@@ -1768,6 +1768,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->proc_info=0;
thd->command=COM_SLEEP;
thd->query=0;
+ thd->query_length=0;
thread_running--;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory
@@ -1807,6 +1808,7 @@ bool alloc_query(THD *thd, char *packet, ulong packet_length)
packet_length--;
}
/* We must allocate some extra memory for query cache */
+ thd->query_length= 0; // Extra safety: Avoid races
if (!(thd->query= (char*) thd->memdup_w_gap((gptr) (packet),
packet_length,
thd->db_length+ 1 +