From 3f3a84f46e564e482c00023d903cc5c03914c99a Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Fri, 28 Feb 2014 00:23:20 +0400 Subject: 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. --- sql/sql_audit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/sql_audit.cc') 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); } -- cgit v1.2.1