diff options
author | Ramil Kalimullin <ramil@mysql.com> | 2009-09-11 22:06:27 +0500 |
---|---|---|
committer | Ramil Kalimullin <ramil@mysql.com> | 2009-09-11 22:06:27 +0500 |
commit | b6c16b329a861b4b7da9cda2ede9921af912fd38 (patch) | |
tree | 98ac2229cd084bbe50f4f9944773a4e7d60200c8 /sql/log.cc | |
parent | 057192abbd261f453711a3296c48f091a702019a (diff) | |
download | mariadb-git-b6c16b329a861b4b7da9cda2ede9921af912fd38.tar.gz |
Fix for bug#47130: misplaced or redundant check for null pointer?
Problem: LOGGER::general_log_write() relied on valid "thd" parameter passed
but had inconsistent "if (thd)" check.
Fix: as we always pass a valid "thd" parameter to the method,
redundant check removed.
sql/log.cc:
Fix for bug#47130: misplaced or redundant check for null pointer?
- code clean-up, as we rely on the "thd" parameter in the
LOGGER::general_log_write(), redundant "if (thd)" check removed,
added assert(thd) instead.
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sql/log.cc b/sql/log.cc index 1af2f3a4ddc..feaa5499912 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1024,14 +1024,10 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command, Log_event_handler **current_handler= general_log_handler_list; char user_host_buff[MAX_USER_HOST_SIZE + 1]; Security_context *sctx= thd->security_ctx; - ulong id; uint user_host_len= 0; time_t current_time; - if (thd) - id= thd->thread_id; /* Normal thread */ - else - id= 0; /* Log from connect handler */ + DBUG_ASSERT(thd); lock_shared(); if (!opt_log) @@ -1050,7 +1046,7 @@ bool LOGGER::general_log_write(THD *thd, enum enum_server_command command, while (*current_handler) error|= (*current_handler++)-> log_general(thd, current_time, user_host_buff, - user_host_len, id, + user_host_len, thd->thread_id, command_name[(uint) command].str, command_name[(uint) command].length, query, query_length, |