diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2014-02-28 00:23:20 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2014-02-28 00:23:20 +0400 |
commit | 3f3a84f46e564e482c00023d903cc5c03914c99a (patch) | |
tree | 39a0e0771129e6ff69af4c7107f7d22ba7ccc3b5 /sql/sql_audit.cc | |
parent | 525c00c682bc536757b336ff5f3aee7725a5a852 (diff) | |
download | mariadb-git-3f3a84f46e564e482c00023d903cc5c03914c99a.tar.gz |
MDEV-5436 mysqld crash signal 11 in mysql_audit_general.
That error 'Can't open the pid file' leads to mysqld crash signal 11 in mysql_audit_general() called
with the 'thd' parameter set to NULL. That wasn't checked when the thd->db and thd->db_length
were accessed. Fixed by checking for the NULL thd.
Diffstat (limited to 'sql/sql_audit.cc')
-rw-r--r-- | sql/sql_audit.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_audit.cc b/sql/sql_audit.cc index 1dab45800d9..108b74cac5f 100644 --- a/sql/sql_audit.cc +++ b/sql/sql_audit.cc @@ -84,7 +84,7 @@ static void general_class_handler(THD *thd, uint event_subtype, va_list ap) event.general_rows= (unsigned long long) va_arg(ap, ha_rows); event.database= va_arg(ap, const char *); event.database_length= va_arg(ap, unsigned int); - event.query_id= (unsigned long long) thd->query_id; + event.query_id= (unsigned long long) (thd ? thd->query_id : 0); event_class_dispatch(thd, MYSQL_AUDIT_GENERAL_CLASS, &event); } @@ -134,7 +134,7 @@ static void table_class_handler(THD *thd, uint event_subclass, va_list ap) event.new_database_length= va_arg(ap, unsigned int); event.new_table= va_arg(ap, const char *); event.new_table_length= va_arg(ap, unsigned int); - event.query_id= (unsigned long long) thd->query_id; + event.query_id= (unsigned long long) (thd ? thd->query_id : 0); event_class_dispatch(thd, MYSQL_AUDIT_TABLE_CLASS, &event); } |