diff options
author | Konstantin Osipov <kostja@sun.com> | 2009-11-23 14:01:20 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2009-11-23 14:01:20 +0300 |
commit | f238113decc10e345a6e2b26d83eefeb53f188f0 (patch) | |
tree | 7385c9ace0866a812291ad1c4b897fbacae76ae8 | |
parent | 6156cfee673788318fd63927d576273f004bf5a9 (diff) | |
download | mariadb-git-f238113decc10e345a6e2b26d83eefeb53f188f0.tar.gz |
Backport of:
------------------------------------------------------------
revno: 2642
committer: davi@mysql.com/endora.local
timestamp: Fri 2008-05-16 01:29:09 -0300
message:
Fix for a valgrind warning due to a jump on a uninitialized
variable. The problem was that the sql profile preparation
function wasn't being called for all possible code paths
of query execution. The solution is to move the preparation
to the dispatch_command function and to explicitly call the
profile preparation function on bootstrap.
-rw-r--r-- | sql/sql_parse.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 99fb08abcca..c2021710d6c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -812,11 +812,7 @@ bool do_command(THD *thd) net_new_transaction(net); - packet_length= my_net_read(net); -#if defined(ENABLED_PROFILING) - thd->profiling.start_new_query(); -#endif - if (packet_length == packet_error) + if ((packet_length= my_net_read(net)) == packet_error) { DBUG_PRINT("info",("Got error %d reading command from socket %s", net->error, @@ -873,9 +869,6 @@ bool do_command(THD *thd) return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1)); out: -#if defined(ENABLED_PROFILING) - thd->profiling.finish_current_query(); -#endif DBUG_RETURN(return_value); } #endif /* EMBEDDED_LIBRARY */ @@ -977,6 +970,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, DBUG_ENTER("dispatch_command"); DBUG_PRINT("info",("packet: '%*.s'; command: %d", packet_length, packet, command)); +#if defined(ENABLED_PROFILING) + thd->profiling.start_new_query(); +#endif MYSQL_COMMAND_START(thd->thread_id, command, thd->security_ctx->priv_user, (char *) thd->security_ctx->host_or_ip); @@ -1608,6 +1604,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); +#if defined(ENABLED_PROFILING) + thd->profiling.finish_current_query(); +#endif if (MYSQL_QUERY_DONE_ENABLED() || MYSQL_COMMAND_DONE_ENABLED()) { int res; |