diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index f36805012b2..d6c07d48a6b 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -203,7 +203,8 @@ void PROF_MEASUREMENT::set_label(const char *status_arg, sizes[2]= (file_arg == NULL) ? 0 : strlen(file_arg) + 1; allocated_status_memory= (char *) my_malloc(sizes[0] + sizes[1] + sizes[2], MYF(0)); - DBUG_ASSERT(allocated_status_memory != NULL); + if (!allocated_status_memory) + return; cursor= allocated_status_memory; @@ -267,6 +268,8 @@ QUERY_PROFILE::QUERY_PROFILE(PROFILING *profiling_arg, const char *status_arg) { m_seq_counter= 1; PROF_MEASUREMENT *prof= new PROF_MEASUREMENT(this, status_arg); + if (!prof) + return; prof->m_seq= m_seq_counter++; m_start_time_usecs= prof->time_usecs; m_end_time_usecs= m_start_time_usecs; @@ -308,6 +311,8 @@ void QUERY_PROFILE::new_status(const char *status_arg, prof= new PROF_MEASUREMENT(this, status_arg, function_arg, base_name(file_arg), line_arg); else prof= new PROF_MEASUREMENT(this, status_arg); + if (!prof) + DBUG_VOID_RETURN; prof->m_seq= m_seq_counter++; m_end_time_usecs= prof->time_usecs; diff --git a/sql/sql_profile.h b/sql/sql_profile.h index 5b03acf59c0..f618d059e2e 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -98,6 +98,8 @@ public: struct queue_item *new_item; new_item= (struct queue_item *) my_malloc(sizeof(struct queue_item), MYF(0)); + if (!new_item) + return; new_item->payload= payload; @@ -291,7 +293,11 @@ public: { DBUG_ASSERT(!current); if (unlikely(enabled)) - current= new QUERY_PROFILE(this, initial_state); + { + QUERY_PROFILE *new_profile= new QUERY_PROFILE(this, initial_state); + if (new_profile) + current= new_profile; + } } void discard_current_query();