diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index ca9fb8ae194..3a1a03d162b 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -1238,6 +1238,8 @@ public: table_field->read_stats->histogram= hist; return hist; } + else + delete hist; } return NULL; } @@ -1647,10 +1649,10 @@ Histogram_base *create_histogram(MEM_ROOT *mem_root, Histogram_type hist_type, switch (hist_type) { case SINGLE_PREC_HB: case DOUBLE_PREC_HB: - res= new (mem_root) Histogram_binary(); + res= new Histogram_binary(); break; case JSON_HB: - res= new (mem_root) Histogram_json_hb(); + res= new Histogram_json_hb(); break; default: DBUG_ASSERT(0); diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h index 601c5bf907f..20a9bb9dd83 100644 --- a/sql/sql_statistics.h +++ b/sql/sql_statistics.h @@ -151,7 +151,7 @@ class Histogram_builder; /* Common base for all histograms */ -class Histogram_base : public Sql_alloc +class Histogram_base { public: virtual bool parse(MEM_ROOT *mem_root, Field *field, Histogram_type type_arg,