diff options
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 1804eb5fbd3..44efa1cbe68 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -377,8 +377,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin) if (!hton) goto end; - switch (hton->state) - { + switch (hton->state) { case SHOW_OPTION_NO: case SHOW_OPTION_DISABLED: break; @@ -432,8 +431,11 @@ int ha_initialize_handlerton(st_plugin_int *plugin) if (plugin->plugin->init && plugin->plugin->init(hton)) { sql_print_error("Plugin '%s' init function returned error.", - plugin->name.str); - goto err; + plugin->name.str); + /* Free data, so that we don't refer to it in ha_finalize_handlerton */ + my_free(hton, MYF(0)); + plugin->data= 0; + goto err; } /* @@ -460,13 +462,19 @@ int ha_initialize_handlerton(st_plugin_int *plugin) if (idx == (int) DB_TYPE_DEFAULT) { sql_print_warning("Too many storage engines!"); - goto err_deinit; + my_free(hton, MYF(0)); + plugin->data= 0; + goto err_deinit; } if (hton->db_type != DB_TYPE_UNKNOWN) sql_print_warning("Storage engine '%s' has conflicting typecode. " "Assigning value %d.", plugin->plugin->name, idx); hton->db_type= (enum legacy_db_type) idx; } + installed_htons[hton->db_type]= hton; + tmp= hton->savepoint_offset; + hton->savepoint_offset= savepoint_alloc_size; + savepoint_alloc_size+= tmp; /* In case a plugin is uninstalled and re-installed later, it should @@ -2273,8 +2281,8 @@ int handler::update_auto_increment() DBUG_ASSERT(next_insert_id >= auto_inc_interval_for_cur_row.minimum()); if ((nr= table->next_number_field->val_int()) != 0 || - table->auto_increment_field_not_null && - thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO) + (table->auto_increment_field_not_null && + thd->variables.sql_mode & MODE_NO_AUTO_VALUE_ON_ZERO)) { /* Update next_insert_id if we had already generated a value in this |