diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-08 18:20:08 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-08 18:20:08 -0300 |
commit | f56dd32bf7c5b8a8cf35984f39f1a253b75945ff (patch) | |
tree | 6c88c3c07b30acb464ca8bf81bbef916216da616 /sql | |
parent | d3b01fef18b20f3ac589f2ecc95d64326570583f (diff) | |
download | mariadb-git-f56dd32bf7c5b8a8cf35984f39f1a253b75945ff.tar.gz |
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
client/mysqldump.c:
Pass my_free directly as its signature is compatible with the
callback type -- which wasn't the case for free_table_ent.
Diffstat (limited to 'sql')
65 files changed, 299 insertions, 340 deletions
diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index dde6267331f..74e5b2c70f3 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -626,7 +626,7 @@ void debug_sync_end_thread(THD *thd) action->wait_for.free(); action->sync_point.free(); } - my_free(ds_control->ds_action, MYF(0)); + my_free(ds_control->ds_action); } /* Statistics. */ @@ -637,7 +637,7 @@ void debug_sync_end_thread(THD *thd) debug_sync_global.dsp_max_active= ds_control->dsp_max_active; mysql_mutex_unlock(&debug_sync_global.ds_mutex); - my_free(ds_control, MYF(0)); + my_free(ds_control); thd->debug_sync_control= NULL; } diff --git a/sql/derror.cc b/sql/derror.cc index 7f1435e89c1..bf8c589a65f 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -79,7 +79,7 @@ bool init_errmessage(void) /* Register messages for use with my_error(). */ if (my_error_register(get_server_errmsgs, ER_ERROR_FIRST, ER_ERROR_LAST)) { - x_free((uchar*) errmsgs); + my_free(errmsgs); DBUG_RETURN(TRUE); } @@ -155,7 +155,8 @@ Check that the above file is the right version for this program!", DBUG_RETURN(1); } - x_free((uchar*) *point); /* Free old language */ + /* Free old language */ + my_free(*point); if (!(*point= (const char**) my_malloc((size_t) (length+count*sizeof(char*)),MYF(0)))) { diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index c778d72a016..dd1845b29bc 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -176,7 +176,7 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n) return TRUE; if (!(name.str= my_strndup(n.str, name.length= n.length, MYF(MY_WME)))) { - my_free((uchar*) dbname.str, MYF(0)); + my_free(dbname.str); return TRUE; } return FALSE; @@ -192,8 +192,8 @@ Event_queue_element_for_exec::init(LEX_STRING db, LEX_STRING n) Event_queue_element_for_exec::~Event_queue_element_for_exec() { - my_free((uchar*) dbname.str, MYF(0)); - my_free((uchar*) name.str, MYF(0)); + my_free(dbname.str); + my_free(name.str); } diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index c646642dbba..aa4d376d86e 100755 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -238,7 +238,7 @@ event_scheduler_thread(void *arg) res= post_init_event_thread(thd); DBUG_ENTER("event_scheduler_thread"); - my_free((char*)arg, MYF(0)); + my_free(arg); if (!res) scheduler->run(thd); diff --git a/sql/examples/CMakeLists.txt b/sql/examples/CMakeLists.txt index 1a22e9a3efd..3c5cc23ec3b 100755 --- a/sql/examples/CMakeLists.txt +++ b/sql/examples/CMakeLists.txt @@ -13,8 +13,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") -SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") +SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFE_MUTEX") +SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFE_MUTEX") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/extra/yassl/include diff --git a/sql/filesort.cc b/sql/filesort.cc index 3f3dc4e1e3e..af9387c3129 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -264,7 +264,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, { if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer) { - x_free(table_sort.buffpek); + my_free(table_sort.buffpek); table_sort.buffpek= 0; } if (!(table_sort.buffpek= @@ -304,13 +304,12 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, error =0; err: - if (param.tmp_buffer) - x_free(param.tmp_buffer); + my_free(param.tmp_buffer); if (!subselect || !subselect->is_uncacheable()) { - x_free((uchar*) sort_keys); + my_free(sort_keys); table_sort.sort_keys= 0; - x_free((uchar*) buffpek); + my_free(buffpek); table_sort.buffpek= 0; table_sort.buffpek_len= 0; } @@ -347,32 +346,22 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, void filesort_free_buffers(TABLE *table, bool full) { - if (table->sort.record_pointers) - { - my_free((uchar*) table->sort.record_pointers,MYF(0)); - table->sort.record_pointers=0; - } + my_free(table->sort.record_pointers); + table->sort.record_pointers= NULL; + if (full) { - if (table->sort.sort_keys ) - { - x_free((uchar*) table->sort.sort_keys); - table->sort.sort_keys= 0; - } - if (table->sort.buffpek) - { - x_free((uchar*) table->sort.buffpek); - table->sort.buffpek= 0; - table->sort.buffpek_len= 0; - } - } - if (table->sort.addon_buf) - { - my_free((char *) table->sort.addon_buf, MYF(0)); - my_free((char *) table->sort.addon_field, MYF(MY_ALLOW_ZERO_PTR)); - table->sort.addon_buf=0; - table->sort.addon_field=0; + my_free(table->sort.sort_keys); + table->sort.sort_keys= NULL; + my_free(table->sort.buffpek); + table->sort.buffpek= NULL; + table->sort.buffpek_len= NULL; } + + my_free(table->sort.addon_buf); + my_free(table->sort.addon_field); + table->sort.addon_buf= NULL; + table->sort.addon_field= NULL; } /** Make a array of string pointers. */ @@ -413,7 +402,7 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count, if (reinit_io_cache(buffpek_pointers,READ_CACHE,0L,0,0) || my_b_read(buffpek_pointers, (uchar*) tmp, length)) { - my_free((char*) tmp, MYF(0)); + my_free(tmp); tmp=0; } } diff --git a/sql/gstream.h b/sql/gstream.h index 65acc2ff193..6bb3c9bac10 100644 --- a/sql/gstream.h +++ b/sql/gstream.h @@ -45,7 +45,7 @@ public: {} ~Gis_read_stream() { - my_free((uchar*) m_err_msg, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_err_msg); } enum enum_tok_types get_next_toc_type(); diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 68b98c79a50..ecf2984a4c0 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -1035,7 +1035,7 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, } if (loop == 0 && offset > buffer_size) { - my_free(buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buffer); buffer_size= 0; DBUG_PRINT("info", ("allocate blobs buffer size %u", offset)); buffer= (uchar*) my_malloc(offset, MYF(MY_WME)); @@ -1188,8 +1188,8 @@ int ha_ndbcluster::get_metadata(const char *path) if (readfrm(path, &data, &length) || packfrm(data, length, &pack_data, &pack_length)) { - my_free(data, MYF(MY_ALLOW_ZERO_PTR)); - my_free(pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); DBUG_RETURN(1); } @@ -1208,8 +1208,8 @@ int ha_ndbcluster::get_metadata(const char *path) DBUG_DUMP("frm", (uchar*) tab->getFrmData(), tab->getFrmLength()); error= HA_ERR_TABLE_DEF_CHANGED; } - my_free((char*)data, MYF(0)); - my_free((char*)pack_data, MYF(0)); + my_free(data); + my_free(pack_data); if (error) goto err; @@ -1235,7 +1235,7 @@ static int fix_unique_index_attr_order(NDB_INDEX_DATA &data, unsigned sz= index->getNoOfIndexColumns(); if (data.unique_index_attrid_map) - my_free((char*)data.unique_index_attrid_map, MYF(0)); + my_free(data.unique_index_attrid_map); data.unique_index_attrid_map= (uchar*)my_malloc(sz,MYF(MY_WME)); if (data.unique_index_attrid_map == 0) { @@ -1313,7 +1313,7 @@ static void ndb_clear_index(NDB_INDEX_DATA &data) { if (data.unique_index_attrid_map) { - my_free((char*)data.unique_index_attrid_map, MYF(0)); + my_free(data.unique_index_attrid_map); } if (data.index_stat) { @@ -5399,15 +5399,15 @@ int ha_ndbcluster::create(const char *name, DBUG_RETURN(1); if (packfrm(data, length, &pack_data, &pack_length)) { - my_free((char*)data, MYF(0)); + my_free(data); DBUG_RETURN(2); } DBUG_PRINT("info", ("setFrm data: 0x%lx len: %lu", (long) pack_data, (ulong) pack_length)); tab.setFrm(pack_data, pack_length); - my_free((char*)data, MYF(0)); - my_free((char*)pack_data, MYF(0)); + my_free(data); + my_free(pack_data); /* Check for disk options @@ -5751,8 +5751,8 @@ int ha_ndbcluster::create_handler_files(const char *file, packfrm(data, length, &pack_data, &pack_length)) { DBUG_PRINT("info", ("Missing frm for %s", m_tabname)); - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); error= 1; } else @@ -5766,8 +5766,8 @@ int ha_ndbcluster::create_handler_files(const char *file, set_ndb_err(current_thd, dict->getNdbError()); error= ndb_to_mysql_error(&dict->getNdbError()); } - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); } set_ndb_share_state(m_share, NSS_INITIAL); @@ -6565,7 +6565,7 @@ ha_ndbcluster::~ha_ndbcluster() free_share(&m_share); } release_metadata(thd, ndb); - my_free(m_blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_blobs_buffer); m_blobs_buffer= 0; // Check for open cursor/transaction @@ -6911,7 +6911,7 @@ int ndbcluster_discover(handlerton *hton, THD* thd, const char *db, DBUG_RETURN(0); err: - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); if (share) { /* ndb_share reference temporary free */ @@ -7177,8 +7177,8 @@ int ndbcluster_find_all_files(THD *thd) free_share(&share); } } - my_free((char*) data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); mysql_mutex_lock(&LOCK_open); if (discover) @@ -8681,7 +8681,7 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table, if (my_hash_insert(&ndbcluster_open_tables, (uchar*) share)) { free_root(&share->mem_root, MYF(0)); - my_free((uchar*) share, 0); + my_free(share); *root_ptr= old_root; if (!have_lock) mysql_mutex_unlock(&ndbcluster_mutex); @@ -8752,7 +8752,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share) } #endif free_root(&(*share)->mem_root, MYF(0)); - my_free((uchar*) *share, MYF(0)); + my_free(*share); *share= 0; dbug_print_open_tables(); @@ -10076,7 +10076,7 @@ int ha_ndbcluster::set_range_data(void *tab_ref, partition_info *part_info) } tab->setRangeListData(range_data, sizeof(int32)*part_info->num_parts); error: - my_free((char*)range_data, MYF(0)); + my_free(range_data); DBUG_RETURN(error); } @@ -10113,7 +10113,7 @@ int ha_ndbcluster::set_list_data(void *tab_ref, partition_info *part_info) } tab->setRangeListData(list_data, 2*sizeof(int32)*part_info->num_list_values); error: - my_free((char*)list_data, MYF(0)); + my_free(list_data); DBUG_RETURN(error); } diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index ab046164485..4f8bb66fcb0 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -1020,7 +1020,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share, ptrdiff); if (ret != 0) { - my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(blobs_buffer); DBUG_PRINT("info", ("blob read error")); DBUG_ASSERT(FALSE); } @@ -1071,7 +1071,7 @@ static void ndbcluster_get_schema(NDB_SHARE *share, field++; s->type= ((Field_long *)*field)->val_int(); /* free blobs buffer */ - my_free(blobs_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(blobs_buffer); dbug_tmp_restore_column_map(table->read_set, old_map); } @@ -1739,7 +1739,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, old->getObjectVersion() != altered_table->getObjectVersion()) dict->putTable(altered_table); - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); data= NULL; if ((error= unpackfrm(&data, &length, (const uchar*) altered_table->getFrmData())) || @@ -1772,8 +1772,8 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, mysql_mutex_unlock(&LOCK_open); } - my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(pack_data); } // If only frm was changed continue replicating @@ -3507,8 +3507,8 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp, if (share->flags & NSF_BLOB_FLAG) { - my_free(blobs_buffer[0], MYF(MY_ALLOW_ZERO_PTR)); - my_free(blobs_buffer[1], MYF(MY_ALLOW_ZERO_PTR)); + my_free(blobs_buffer[0]); + my_free(blobs_buffer[1]); } return 0; @@ -3580,7 +3580,7 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, ndb_schema_object->key_length= length; if (my_hash_insert(&ndb_schema_objects, (uchar*) ndb_schema_object)) { - my_free((uchar*) ndb_schema_object, 0); + my_free(ndb_schema_object); break; } mysql_mutex_init(key_ndb_schema_object_mutex, &ndb_schema_object->mutex, MY_MUTEX_INIT_FAST); @@ -3612,7 +3612,7 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count)); my_hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object); mysql_mutex_destroy(&(*ndb_schema_object)->mutex); - my_free((uchar*) *ndb_schema_object, MYF(0)); + my_free(*ndb_schema_object); *ndb_schema_object= 0; } else diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 3fb5a30b560..90a4802082b 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -287,7 +287,7 @@ ha_partition::~ha_partition() for (i= 0; i < m_tot_parts; i++) delete m_file[i]; } - my_free((char*) m_ordered_rec_buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_ordered_rec_buffer); clear_handler_file(); DBUG_VOID_RETURN; @@ -2267,7 +2267,7 @@ bool ha_partition::create_handler_file(const char *name) } else result= TRUE; - my_free((char*) file_buffer, MYF(0)); + my_free(file_buffer); DBUG_RETURN(result); } @@ -2285,8 +2285,8 @@ void ha_partition::clear_handler_file() { if (m_engine_array) plugin_unlock_list(NULL, m_engine_array, m_tot_parts); - my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR)); - my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_file_buffer); + my_free(m_engine_array); m_file_buffer= NULL; m_engine_array= NULL; } @@ -2495,7 +2495,7 @@ bool ha_partition::get_from_handler_file(const char *name, MEM_ROOT *mem_root) err3: my_afree((gptr) engine_array); err2: - my_free(file_buffer, MYF(0)); + my_free(file_buffer); err1: (void) mysql_file_close(file, MYF(0)); DBUG_RETURN(TRUE); diff --git a/sql/handler.cc b/sql/handler.cc index 587490dd708..b42840c7b1b 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -392,7 +392,7 @@ static int ha_finish_errors(void) /* Allocate a pointer array for the error message strings. */ if (! (errmsgs= my_error_unregister(HA_ERR_FIRST, HA_ERR_LAST))) return 1; - my_free((uchar*) errmsgs, MYF(0)); + my_free(errmsgs); return 0; } @@ -447,7 +447,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin) hton2plugin[hton->slot]= NULL; } - my_free((uchar*)hton, MYF(0)); + my_free(hton); end: DBUG_RETURN(0); @@ -580,7 +580,7 @@ err_deinit: (void) plugin->plugin->deinit(NULL); err: - my_free((uchar*) hton, MYF(0)); + my_free(hton); err_no_hton_memory: plugin->data= NULL; DBUG_RETURN(1); @@ -1630,7 +1630,7 @@ int ha_recover(HASH *commit_list) plugin_foreach(NULL, xarecover_handlerton, MYSQL_STORAGE_ENGINE_PLUGIN, &info); - my_free((uchar*)info.list, MYF(0)); + my_free(info.list); if (info.found_foreign_xids) sql_print_warning("Found %d prepared XA transactions", info.found_foreign_xids); @@ -3658,7 +3658,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name) build_table_filename(path, sizeof(path) - 1, db, name, "", 0); // Save the frm file error= writefrm(path, frmblob, frmlen); - my_free(frmblob, MYF(0)); + my_free(frmblob); if (error) DBUG_RETURN(2); @@ -4865,7 +4865,7 @@ int fl_log_iterator_next(struct handler_iterator *iterator, void fl_log_iterator_destroy(struct handler_iterator *iterator) { - my_free((uchar*)iterator->buffer, MYF(MY_ALLOW_ZERO_PTR)); + my_free(iterator->buffer); } diff --git a/sql/handler.h b/sql/handler.h index fc49d9e647d..5e08ed23bef 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -458,11 +458,7 @@ typedef struct xid_t XID; /* for recover() handlerton call */ #define MIN_XID_LIST_SIZE 128 -#ifdef SAFEMALLOC -#define MAX_XID_LIST_SIZE 256 -#else #define MAX_XID_LIST_SIZE (1024*128) -#endif /* These structures are used to pass information from a set of SQL commands diff --git a/sql/item_func.cc b/sql/item_func.cc index efa14c8498b..2d5848e314e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3560,7 +3560,7 @@ public: { if (my_hash_insert(&hash_user_locks,(uchar*) this)) { - my_free(key,MYF(0)); + my_free(key); key=0; } } @@ -3570,7 +3570,7 @@ public: if (key) { my_hash_delete(&hash_user_locks,(uchar*) this); - my_free(key, MYF(0)); + my_free(key); } mysql_cond_destroy(&cond); } @@ -4079,7 +4079,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, memcpy(entry->name.str, name.str, name.length+1); if (my_hash_insert(hash,(uchar*) entry)) { - my_free((char*) entry,MYF(0)); + my_free(entry); return 0; } } @@ -4217,7 +4217,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, { char *pos= (char*) entry+ ALIGN_SIZE(sizeof(user_var_entry)); if (entry->value && entry->value != pos) - my_free(entry->value,MYF(0)); + my_free(entry->value); entry->value= 0; entry->length= 0; } @@ -4232,7 +4232,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, uint length, if (entry->value != pos) { if (entry->value) - my_free(entry->value,MYF(0)); + my_free(entry->value); entry->value=pos; } } diff --git a/sql/keycaches.cc b/sql/keycaches.cc index d68e2bccd96..14551803cfc 100644 --- a/sql/keycaches.cc +++ b/sql/keycaches.cc @@ -44,7 +44,7 @@ public: } ~NAMED_ILINK() { - my_free((uchar*) name, MYF(0)); + my_free((void *) name); } }; @@ -104,7 +104,7 @@ KEY_CACHE *create_key_cache(const char *name, uint length) { if (!new NAMED_ILINK(&key_caches, name, length, (uchar*) key_cache)) { - my_free((char*) key_cache, MYF(0)); + my_free(key_cache); key_cache= 0; } else @@ -140,7 +140,7 @@ KEY_CACHE *get_or_create_key_cache(const char *name, uint length) void free_key_cache(const char *name, KEY_CACHE *key_cache) { end_key_cache(key_cache, 1); // Can never fail - my_free((char*) key_cache, MYF(0)); + my_free(key_cache); } diff --git a/sql/lock.cc b/sql/lock.cc index 52d97a2422b..0743120ec6b 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -262,7 +262,7 @@ static void reset_lock_data(MYSQL_LOCK *sql_lock) static void reset_lock_data_and_free(MYSQL_LOCK **mysql_lock) { reset_lock_data(*mysql_lock); - my_free(*mysql_lock, MYF(0)); + my_free(*mysql_lock); *mysql_lock= 0; } @@ -384,7 +384,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock) thr_multi_unlock(sql_lock->locks,sql_lock->lock_count); if (sql_lock->table_count) (void) unlock_external(thd,sql_lock->table,sql_lock->table_count); - my_free((uchar*) sql_lock,MYF(0)); + my_free(sql_lock); DBUG_VOID_RETURN; } @@ -545,7 +545,7 @@ void mysql_lock_abort(THD *thd, TABLE *table, bool upgrade_lock) { for (uint i=0; i < locked->lock_count; i++) thr_abort_locks(locked->locks[i]->lock, upgrade_lock); - my_free((uchar*) locked,MYF(0)); + my_free(locked); } DBUG_VOID_RETURN; } @@ -577,7 +577,7 @@ bool mysql_lock_abort_for_thread(THD *thd, TABLE *table) table->in_use->thread_id)) result= TRUE; } - my_free((uchar*) locked,MYF(0)); + my_free(locked); } DBUG_RETURN(result); } @@ -619,8 +619,8 @@ MYSQL_LOCK *mysql_lock_merge(MYSQL_LOCK *a,MYSQL_LOCK *b) } /* Delete old, not needed locks */ - my_free((uchar*) a,MYF(0)); - my_free((uchar*) b,MYF(0)); + my_free(a); + my_free(b); thr_lock_merge_status(sql_lock->locks, sql_lock->lock_count); DBUG_RETURN(sql_lock); diff --git a/sql/log.cc b/sql/log.cc index 0ac61513d22..521cedffc81 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1501,7 +1501,7 @@ static int binlog_close_connection(handlerton *hton, THD *thd) DBUG_ASSERT(cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty()); thd_set_ha_data(thd, binlog_hton, NULL); cache_mngr->~binlog_cache_mngr(); - my_free((uchar*)cache_mngr, MYF(0)); + my_free(cache_mngr); return 0; } @@ -2245,7 +2245,8 @@ shutdown the MySQL server and restart it.", name, errno); if (file >= 0) mysql_file_close(file, MYF(0)); end_io_cache(&log_file); - safeFree(name); + my_free(name); + name= NULL; log_state= LOG_CLOSED; DBUG_RETURN(1); } @@ -2306,7 +2307,8 @@ void MYSQL_LOG::close(uint exiting) } log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED; - safeFree(name); + my_free(name); + name= NULL; DBUG_VOID_RETURN; } @@ -2384,7 +2386,7 @@ void MYSQL_QUERY_LOG::reopen_file() */ open(save_name, log_type, 0, io_cache_type); - my_free(save_name, MYF(0)); + my_free(save_name); mysql_mutex_unlock(&LOCK_log); @@ -2985,7 +2987,8 @@ shutdown the MySQL server and restart it.", name, errno); mysql_file_close(file, MYF(0)); end_io_cache(&log_file); end_io_cache(&index_file); - safeFree(name); + my_free(name); + name= NULL; log_state= LOG_CLOSED; DBUG_RETURN(1); } @@ -3318,7 +3321,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) need_start_event=1; if (!open_index_file(index_file_name, 0, FALSE)) open(save_name, log_type, 0, io_cache_type, no_auto_events, max_size, 0, FALSE); - my_free((uchar*) save_name, MYF(0)); + my_free((void *) save_name); err: if (error == 1) @@ -3456,7 +3459,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) DBUG_ASSERT(!included || rli->linfo.index_file_start_offset == 0); err: - my_free(to_purge_if_included, MYF(0)); + my_free(to_purge_if_included); mysql_mutex_unlock(&LOCK_index); DBUG_RETURN(error); } @@ -4096,7 +4099,7 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock) if (!open_index_file(index_file_name, 0, FALSE)) open(old_name, log_type, new_name_ptr, io_cache_type, no_auto_events, max_size, 1, FALSE); - my_free(old_name,MYF(0)); + my_free(old_name); end: if (need_lock) @@ -4354,7 +4357,7 @@ int THD::binlog_setup_trx_data() open_cached_file(&cache_mngr->trx_cache.cache_log, mysql_tmpdir, LOG_PREFIX, binlog_cache_size, MYF(MY_WME))) { - my_free((uchar*)cache_mngr, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache_mngr); DBUG_RETURN(1); // Didn't manage to set it up } thd_set_ha_data(this, binlog_hton, cache_mngr); @@ -5361,7 +5364,8 @@ void MYSQL_BIN_LOG::close(uint exiting) } } log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED; - safeFree(name); + my_free(name); + name= NULL; DBUG_VOID_RETURN; } @@ -6052,7 +6056,7 @@ void TC_LOG_MMAP::close() mysql_cond_destroy(&pages[i].cond); } case 3: - my_free((uchar*)pages, MYF(0)); + my_free(pages); case 2: my_munmap((char*)data, (size_t)file_length); case 1: diff --git a/sql/log_event.cc b/sql/log_event.cc index 606f5945a07..52275a4b6bd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1149,7 +1149,7 @@ err: sql_print_error("Error in Log_event::read_log_event(): " "'%s', data_len: %d, event_type: %d", error,data_len,head[EVENT_TYPE_OFFSET]); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); /* The SQL slave thread will check if file->error<0 to know if there was an I/O error. Even if there is no "low-level" I/O errors @@ -2066,7 +2066,7 @@ void Log_event::print_base64(IO_CACHE* file, } } - my_free(tmp_str, MYF(0)); + my_free(tmp_str); DBUG_VOID_RETURN; } @@ -2146,7 +2146,7 @@ void Query_log_event::pack_info(Protocol *protocol) pos+= q_len; } protocol->store(buf, pos-buf, &my_charset_bin); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); } #endif @@ -3965,7 +3965,7 @@ Format_description_log_event(const char* buf, DBUG_PRINT("info", (" number_of_event_types=%d", number_of_event_types)); /* this makes is_valid() return false. */ - my_free(post_header_len, MYF(MY_ALLOW_ZERO_PTR)); + my_free(post_header_len); post_header_len= NULL; DBUG_VOID_RETURN; } @@ -4288,7 +4288,7 @@ void Load_log_event::pack_info(Protocol *protocol) return; print_query(TRUE, NULL, buf, &end, 0, 0); protocol->store(buf, end-buf, &my_charset_bin); - my_free(buf, MYF(0)); + my_free(buf); } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -5557,7 +5557,7 @@ void User_var_log_event::pack_info(Protocol* protocol) buf[2+name_len]= '`'; buf[3+name_len]= '='; protocol->store(buf, event_len, &my_charset_bin); - my_free(buf, MYF(0)); + my_free(buf); } #endif /* !MYSQL_CLIENT */ @@ -5972,7 +5972,7 @@ Slave_log_event::Slave_log_event(THD* thd_arg, Slave_log_event::~Slave_log_event() { - my_free(mem_pool, MYF(MY_ALLOW_ZERO_PTR)); + my_free(mem_pool); } @@ -6794,7 +6794,7 @@ int Execute_load_log_event::do_apply_event(Relay_log_info const *rli) { rli->report(ERROR_LEVEL, rli->last_error().number, "%s. Failed executing load from '%s'", tmp, fname); - my_free(tmp,MYF(0)); + my_free(tmp); } goto err; } @@ -6999,7 +6999,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol) pos= strmov(pos, " ;file_id="); pos= int10_to_str((long) file_id, pos, 10); protocol->store(buf, pos-buf, &my_charset_bin); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); } @@ -7015,7 +7015,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli) buf= (char*) my_malloc(q_len + 1 - (fn_pos_end - fn_pos_start) + (FN_REFLEN + 10) + 10 + 8 + 5, MYF(MY_WME)); - DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf, MYF(0)); buf= NULL;); + DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error", my_free(buf); buf= NULL;); /* Replace filename and LOCAL keyword in query before executing it */ if (buf == NULL) @@ -7058,7 +7058,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli) if (!error) mysql_file_delete(key_file_log_event_data, fname, MYF(MY_WME)); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); return error; } #endif @@ -7323,7 +7323,7 @@ Rows_log_event::~Rows_log_event() if (m_cols.bitmap == m_bitbuf) // no my_malloc happened m_cols.bitmap= 0; // so no my_free in bitmap_free bitmap_free(&m_cols); // To pair with bitmap_init(). - my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_rows_buf); } int Rows_log_event::get_data_size() @@ -8247,8 +8247,8 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, Table_map_log_event::~Table_map_log_event() { - my_free(m_meta_memory, MYF(MY_ALLOW_ZERO_PTR)); - my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_meta_memory); + my_free(m_memory); } /* @@ -8298,7 +8298,7 @@ int Table_map_log_event::do_apply_event(Relay_log_info const *rli) (!rpl_filter->db_ok(table_list->db) || (rpl_filter->is_on() && !rpl_filter->tables_ok("", table_list)))) { - my_free(memory, MYF(MY_WME)); + my_free(memory); } else { @@ -9353,7 +9353,7 @@ Delete_rows_log_event::do_after_row_operations(const Slave_reporting_capability { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_key); m_key= NULL; return error; @@ -9476,7 +9476,7 @@ Update_rows_log_event::do_after_row_operations(const Slave_reporting_capability { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc + my_free(m_key); // Free for multi_malloc m_key= NULL; return error; diff --git a/sql/log_event.h b/sql/log_event.h index bd95c74b6c5..0119b11cc23 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1031,7 +1031,7 @@ public: static void operator delete(void *ptr, size_t size) { - my_free((uchar*) ptr, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free(ptr); } /* Placement version of the above operators */ @@ -1088,7 +1088,7 @@ public: { if (temp_buf) { - my_free(temp_buf, MYF(0)); + my_free(temp_buf); temp_buf = 0; } } @@ -1720,7 +1720,7 @@ public: ~Query_log_event() { if (data_buf) - my_free((uchar*) data_buf, MYF(0)); + my_free(data_buf); } Log_event_type get_type_code() { return QUERY_EVENT; } #ifdef MYSQL_SERVER @@ -2299,7 +2299,7 @@ public: *description_event); ~Format_description_log_event() { - my_free((uchar*)post_header_len, MYF(MY_ALLOW_ZERO_PTR)); + my_free(post_header_len); } Log_event_type get_type_code() { return FORMAT_DESCRIPTION_EVENT;} #ifdef MYSQL_SERVER @@ -2698,7 +2698,7 @@ public: ~Rotate_log_event() { if (flags & DUP_NAME) - my_free((uchar*) new_log_ident, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void*) new_log_ident); } Log_event_type get_type_code() { return ROTATE_EVENT;} int get_data_size() { return ident_len + ROTATE_HEADER_LEN;} @@ -2760,7 +2760,7 @@ public: const Format_description_log_event* description_event); ~Create_file_log_event() { - my_free((char*) event_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void*) event_buf); } Log_event_type get_type_code() diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index d9b48cd134e..9263578e0b5 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1017,7 +1017,7 @@ int Delete_rows_log_event_old::do_after_row_operations(TABLE *table, int error) { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ table->file->ha_index_or_rnd_end(); - my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc + my_free(m_memory); // Free for multi_malloc m_memory= NULL; m_after_image= NULL; m_key= NULL; @@ -1116,7 +1116,7 @@ int Update_rows_log_event_old::do_after_row_operations(TABLE *table, int error) { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ table->file->ha_index_or_rnd_end(); - my_free(m_memory, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_memory); m_memory= NULL; m_after_image= NULL; m_key= NULL; @@ -1360,7 +1360,7 @@ Old_rows_log_event::~Old_rows_log_event() if (m_cols.bitmap == m_bitbuf) // no my_malloc happened m_cols.bitmap= 0; // so no my_free in bitmap_free bitmap_free(&m_cols); // To pair with bitmap_init(). - my_free((uchar*)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_rows_buf); } @@ -2698,7 +2698,7 @@ Delete_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabil { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); + my_free(m_key); m_key= NULL; return error; @@ -2797,7 +2797,7 @@ Update_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabil { /*error= ToDo:find out what this should really be, this triggers close_scan in nbd, returning error?*/ m_table->file->ha_index_or_rnd_end(); - my_free(m_key, MYF(MY_ALLOW_ZERO_PTR)); // Free for multi_malloc + my_free(m_key); // Free for multi_malloc m_key= NULL; return error; diff --git a/sql/mdl.cc b/sql/mdl.cc index 184b3c6051d..0426a410d98 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -1935,7 +1935,7 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests, if (acquire_lock(*p_req, lock_wait_timeout)) goto err; } - my_free(sort_buf, MYF(0)); + my_free(sort_buf); return FALSE; err: @@ -1951,7 +1951,7 @@ err: { (*p_req)->ticket= NULL; } - my_free(sort_buf, MYF(0)); + my_free(sort_buf); return TRUE; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 28cad51aa41..35d6137789d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1523,7 +1523,7 @@ void clean_up(bool print_message) if (defaults_argv) free_defaults(defaults_argv); free_tmpdir(&mysql_tmpdir_list); - x_free(opt_bin_logname); + my_free(opt_bin_logname); bitmap_free(&temp_pool); free_max_user_conn(); #ifdef HAVE_REPLICATION @@ -3135,7 +3135,7 @@ void *my_str_malloc_mysqld(size_t size) void my_str_free_mysqld(void *ptr) { - my_free(ptr, MYF(MY_FAE)); + my_free(ptr); } #endif /* EMBEDDED_LIBRARY */ @@ -3708,7 +3708,7 @@ static int init_common_variables() #define FIX_LOG_VAR(VAR, ALT) \ if (!VAR || !*VAR) \ { \ - x_free(VAR); /* it could be an allocated empty string "" */ \ + my_free(VAR); /* it could be an allocated empty string "" */ \ VAR= my_strdup(ALT, MYF(0)); \ } @@ -4144,7 +4144,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); } if (ln == buf) { - my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR)); + my_free(opt_bin_logname); opt_bin_logname=my_strdup(buf, MYF(0)); } if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE)) @@ -5931,7 +5931,7 @@ errorconn: /* End shared memory handling */ error: if (tmp) - my_free(tmp, MYF(0)); + my_free(tmp); if (errmsg) { @@ -6231,14 +6231,6 @@ struct my_option my_long_options[]= "Don't allow new user creation by the user who has no write privileges to the mysql.user table.", &opt_safe_user_create, &opt_safe_user_create, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#if !defined(DBUG_OFF) && defined(SAFEMALLOC) - {"safemalloc", 0, "Enable the memory allocation checking.", - &sf_malloc_quick, &sf_malloc_quick, 0, - GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"safemalloc-mem-limit", 0, "Simulate memory shortage.", - &sf_malloc_mem_limit, &sf_malloc_mem_limit, 0, GET_UINT, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"show-slave-auth-info", 0, "Show user and password in SHOW SLAVE HOSTS on this master.", &opt_show_slave_auth_info, &opt_show_slave_auth_info, 0, @@ -7867,7 +7859,7 @@ static int fix_paths(void) } char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE)); convert_dirname(secure_file_real_path, buff, NullS); - my_free(opt_secure_file_priv, MYF(0)); + my_free(opt_secure_file_priv); opt_secure_file_priv= secure_file_real_path; } } diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 918798529de..83435740ead 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -152,7 +152,7 @@ my_bool my_net_init(NET *net, Vio* vio) void net_end(NET *net) { DBUG_ENTER("net_end"); - my_free(net->buff,MYF(MY_ALLOW_ZERO_PTR)); + my_free(net->buff); net->buff=0; DBUG_VOID_RETURN; } @@ -696,7 +696,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) #endif #ifdef HAVE_COMPRESS if (net->compress) - my_free((char*) packet,MYF(0)); + my_free((void*) packet); #endif if (thr_alarm_in_use(&alarmed)) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index f195da9ae02..48235ba588a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1091,7 +1091,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables, select->file= *head->sort.io_cache; select->records=(ha_rows) (select->file.end_of_file/ head->file->ref_length); - my_free(head->sort.io_cache, MYF(0)); + my_free(head->sort.io_cache); head->sort.io_cache=0; } DBUG_RETURN(select); @@ -1216,11 +1216,11 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() } delete_dynamic(&ranges); /* ranges are allocated in alloc */ free_root(&alloc,MYF(0)); - my_free((char*) column_bitmap.bitmap, MYF(MY_ALLOW_ZERO_PTR)); + my_free(column_bitmap.bitmap); } head->column_bitmaps_set(save_read_set, save_write_set); - x_free(multi_range); - x_free(multi_range_buff); + my_free(multi_range); + my_free(multi_range_buff); DBUG_VOID_RETURN; } @@ -8589,7 +8589,7 @@ int QUICK_RANGE_SELECT::reset() } if (! multi_range_buff) { - my_free((char*) multi_range, MYF(0)); + my_free(multi_range); multi_range= NULL; multi_range_length= 0; DBUG_RETURN(HA_ERR_OUT_OF_MEM); diff --git a/sql/records.cc b/sql/records.cc index 70b7cedb0a5..ccacdc33b36 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -293,7 +293,7 @@ void end_read_record(READ_RECORD *info) { /* free cache if used */ if (info->cache) { - my_free_lock((char*) info->cache,MYF(0)); + my_free_lock(info->cache); info->cache=0; } if (info->table) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 81366d55fc6..9a1f7fb826b 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -205,7 +205,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) return res; err: - my_free(si, MYF(MY_WME)); + my_free(si); my_message(ER_UNKNOWN_ERROR, errmsg, MYF(0)); /* purecov: inspected */ err2: return 1; @@ -221,7 +221,7 @@ extern "C" uint32 extern "C" void slave_info_free(void *s) { - my_free(s, MYF(MY_WME)); + my_free(s); } #ifdef HAVE_PSI_INTERFACE diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index 63521c0398f..42a9a034efd 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -383,7 +383,7 @@ void free_table_ent(void* a) { TABLE_RULE_ENT *e= (TABLE_RULE_ENT *) a; - my_free((uchar*) e, MYF(0)); + my_free(e); } @@ -434,7 +434,7 @@ Rpl_filter::free_string_array(DYNAMIC_ARRAY *a) { char* p; get_dynamic(a, (uchar*) &p, i); - my_free(p, MYF(MY_WME)); + my_free(p); } delete_dynamic(a); } diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index be0a61bcae2..55418cbec84 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -213,7 +213,7 @@ int Trans_delegate::after_commit(THD *thd, bool all) if (is_real_trans && log_info) { my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL); - my_free(log_info, MYF(0)); + my_free(log_info); } return ret; } @@ -241,7 +241,7 @@ int Trans_delegate::after_rollback(THD *thd, bool all) if (is_real_trans && log_info) { my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL); - my_free(log_info, MYF(0)); + my_free(log_info); } return ret; } diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 0f636f5b2ab..75ccb617e9e 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -58,7 +58,7 @@ injector::transaction::~transaction() */ *the_memory= '\0'; - my_free(the_memory, MYF(0)); + my_free(the_memory); } /** diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 443af94e0d0..308f6d7f06e 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -520,7 +520,7 @@ int flush_master_info(Master_info* mi, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert, heartbeat_buf, "", ignore_server_ids_buf); - my_free(ignore_server_ids_buf, MYF(0)); + my_free(ignore_server_ids_buf); err= flush_io_cache(file); if (sync_masterinfo_period && !err && ++(mi->sync_counter) >= sync_masterinfo_period) diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 8f070c51410..08377fe887d 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1251,7 +1251,7 @@ void Relay_log_info::clear_tables_to_lock() tables_to_lock= static_cast<RPL_TABLE_LIST*>(tables_to_lock->next_global); tables_to_lock_count--; - my_free(to_free, MYF(MY_WME)); + my_free(to_free); } DBUG_ASSERT(tables_to_lock == NULL && tables_to_lock_count == 0); } diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 0675e9b51ad..2c6a9e5d9b9 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -1047,7 +1047,7 @@ table_def::table_def(unsigned char *types, ulong size, table_def::~table_def() { - my_free(m_memory, MYF(0)); + my_free(m_memory); #ifndef DBUG_OFF m_type= 0; m_size= 0; diff --git a/sql/slave.cc b/sql/slave.cc index bcb01d77e15..58b23c44bc7 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1154,7 +1154,7 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f) } err: if (buf_act != buf) - my_free(buf_act, MYF(0)); + my_free(buf_act); DBUG_RETURN(ret); } @@ -3686,7 +3686,7 @@ static int queue_binlog_ver_1_event(Master_info *mi, const char *buf, sql_print_error("Read invalid event from master: '%s',\ master could be corrupt but a more likely cause of this is a bug", errmsg); - my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(tmp_buf); DBUG_RETURN(1); } @@ -3723,7 +3723,7 @@ static int queue_binlog_ver_1_event(Master_info *mi, const char *buf, mi->master_log_pos += inc_pos; DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) mi->master_log_pos)); mysql_mutex_unlock(&mi->data_lock); - my_free((char*)tmp_buf, MYF(0)); + my_free(tmp_buf); DBUG_RETURN(error); } default: @@ -3774,7 +3774,7 @@ static int queue_binlog_ver_3_event(Master_info *mi, const char *buf, sql_print_error("Read invalid event from master: '%s',\ master could be corrupt but a more likely cause of this is a bug", errmsg); - my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(tmp_buf); DBUG_RETURN(1); } mysql_mutex_lock(&mi->data_lock); diff --git a/sql/sp_pcontext.cc b/sql/sp_pcontext.cc index 74dda9f456b..bbf38f52efb 100644 --- a/sql/sp_pcontext.cc +++ b/sql/sp_pcontext.cc @@ -19,10 +19,6 @@ #pragma implementation #endif -#if defined(WIN32) || defined(__WIN__) -#undef SAFEMALLOC /* Problems with threads */ -#endif - #include "sp_pcontext.h" #include "sp_head.h" diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc index e3cdf328659..047cec76486 100644 --- a/sql/sp_rcontext.cc +++ b/sql/sp_rcontext.cc @@ -19,10 +19,6 @@ #pragma implementation #endif -#if defined(WIN32) || defined(__WIN__) -#undef SAFEMALLOC /* Problems with threads */ -#endif - #include "mysql.h" #include "sp_head.h" #include "sql_cursor.h" diff --git a/sql/sql_base.cc b/sql/sql_base.cc index a83c0b1c1fd..c3e26bb665d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -885,7 +885,7 @@ static void free_cache_entry(TABLE *table) intern_close_table(table); - my_free((uchar*) table,MYF(0)); + my_free(table); DBUG_VOID_RETURN; } @@ -897,7 +897,7 @@ void free_io_cache(TABLE *table) if (table->sort.io_cache) { close_cached_file(table->sort.io_cache); - my_free((uchar*) table->sort.io_cache,MYF(0)); + my_free(table->sort.io_cache); table->sort.io_cache=0; } DBUG_VOID_RETURN; @@ -2136,7 +2136,7 @@ void close_temporary(TABLE *table, bool free_share, bool delete_table) if (free_share) { free_table_share(table->s); - my_free((char*) table,MYF(0)); + my_free(table); } DBUG_VOID_RETURN; } @@ -3018,7 +3018,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (error) { - my_free(table, MYF(0)); + my_free(table); if (error == 7) (void) ot_ctx->request_backoff_action(Open_table_context::OT_DISCOVER, @@ -3033,7 +3033,7 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, if (open_table_entry_fini(thd, share, table)) { closefrm(table, 0); - my_free((uchar*)table, MYF(0)); + my_free(table); goto err_lock; } @@ -3779,10 +3779,10 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry) query, (ulong)(end-query), FALSE, FALSE, FALSE, errcode)) { - my_free(query, MYF(0)); + my_free(query); return TRUE; } - my_free(query, MYF(0)); + my_free(query); } else { @@ -3867,7 +3867,7 @@ static bool auto_repair_table(THD *thd, TABLE_LIST *table_list) closefrm(entry, 0); result= FALSE; } - my_free(entry, MYF(0)); + my_free(entry); mysql_mutex_lock(&LOCK_open); release_table_share(share); @@ -5751,7 +5751,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, { /* No need to lock share->mutex as this is not needed for tmp tables */ free_table_share(share); - my_free((char*) tmp_table,MYF(0)); + my_free(tmp_table); DBUG_RETURN(0); } diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 0730f7df00c..52ac34b7b60 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -252,6 +252,6 @@ void mysql_client_binlog_statement(THD* thd) end: rli->slave_close_thread_tables(thd); - my_free(buf, MYF(MY_ALLOW_ZERO_PTR)); + my_free(buf); DBUG_VOID_RETURN; } diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 92d54c8e71b..b73de320ef5 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2223,7 +2223,7 @@ void Query_cache::free_cache() { DBUG_ENTER("Query_cache::free_cache"); - my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR)); + my_free(cache); make_disabled(); my_hash_free(&queries); my_hash_free(&tables); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index e781f08b6d4..2fbdc2b58ac 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -100,8 +100,8 @@ extern "C" void free_user_var(user_var_entry *entry) { char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry)); if (entry->value && entry->value != pos) - my_free(entry->value, MYF(0)); - my_free((char*) entry,MYF(0)); + my_free(entry->value); + my_free(entry); } bool Key_part_spec::operator==(const Key_part_spec& other) const @@ -1122,7 +1122,8 @@ THD::~THD() DBUG_PRINT("info", ("freeing security context")); main_security_ctx.destroy(); - safeFree(db); + my_free(db); + db= NULL; free_root(&transaction.mem_root,MYF(0)); mysys_var=0; // Safety (shouldn't be needed) mysql_mutex_destroy(&LOCK_thd_data); @@ -2954,10 +2955,18 @@ void Security_context::destroy() { // If not pointer to constant if (host != my_localhost) - safeFree(host); + { + my_free(host); + host= NULL; + } if (user != delayed_user) - safeFree(user); - safeFree(ip); + { + my_free(user); + user= NULL; + } + + my_free(ip); + ip= NULL; } @@ -2973,7 +2982,7 @@ void Security_context::skip_grants() bool Security_context::set_user(char *user_arg) { - safeFree(user); + my_free(user); user= my_strdup(user_arg, MYF(0)); return user == 0; } @@ -3449,7 +3458,7 @@ uchar *xid_get_hash_key(const uchar *ptr, size_t *length, void xid_free_hash(void *ptr) { if (!((XID_STATE*)ptr)->in_thd) - my_free((uchar*)ptr, MYF(0)); + my_free(ptr); } #ifdef HAVE_PSI_INTERFACE @@ -4256,7 +4265,7 @@ CPP_UNNAMED_NS_START ~Row_data_memory() { if (m_memory != 0 && m_release_memory_on_destruction) - my_free((uchar*) m_memory, MYF(MY_WME)); + my_free(m_memory); } /** diff --git a/sql/sql_class.h b/sql/sql_class.h index 7808cbe4d41..db22fc5d67b 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2657,7 +2657,7 @@ public: memcpy(db, new_db, new_db_len+1); else { - x_free(db); + my_free(db); if (new_db) db= my_strndup(new_db, new_db_len, MYF(MY_WME | ME_FATALERROR)); else diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 35ba39afd81..05d20b386dd 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -98,7 +98,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, if (my_hash_insert(&hash_user_connections, (uchar*) uc)) { /* The only possible error is out of memory, MY_WME sets an error. */ - my_free((char*) uc,0); + my_free(uc); return_val= 1; goto end; } @@ -555,7 +555,7 @@ extern "C" uchar *get_key_conn(user_conn *buff, size_t *length, extern "C" void free_user(struct user_conn *uc) { - my_free((char*) uc,MYF(0)); + my_free(uc); } @@ -940,8 +940,7 @@ static int check_connection(THD *thd) user_len-= 2; } - if (thd->main_security_ctx.user) - x_free(thd->main_security_ctx.user); + my_free(thd->main_security_ctx.user); if (!(thd->main_security_ctx.user= my_strdup(user, MYF(MY_WME)))) return 1; /* The error is set by my_strdup(). */ return check_user(thd, COM_CONNECT, passwd, passwd_len, db, TRUE); diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 2e48475f298..1040fc92851 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -94,7 +94,7 @@ extern "C" void lock_db_free_element(void *ptr); void lock_db_free_element(void *ptr) { - my_free(ptr, MYF(0)); + my_free(ptr); } @@ -136,7 +136,7 @@ static my_bool lock_db_insert(const char *dbname, uint length) opt->name_length= length; if ((error= my_hash_insert(&lock_db_cache, (uchar*) opt))) - my_free(opt, MYF(0)); + my_free(opt); } end: @@ -209,7 +209,7 @@ extern "C" void free_dbopt(void *dbopt); void free_dbopt(void *dbopt) { - my_free((uchar*) dbopt, MYF(0)); + my_free(dbopt); } #ifdef HAVE_PSI_INTERFACE @@ -377,7 +377,7 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) if ((error= my_hash_insert(&dboptions, (uchar*) opt))) { - my_free(opt, MYF(0)); + my_free(opt); goto end; } } @@ -1438,8 +1438,7 @@ static void mysql_change_db_impl(THD *thd, we just call THD::reset_db(). Since THD::reset_db() does not releases the previous database name, we should do it explicitly. */ - - x_free(thd->db); + my_free(thd->db); thd->reset_db(new_db_name->str, new_db_name->length); } @@ -1652,7 +1651,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) if (check_db_name(&new_db_file_name)) { my_error(ER_WRONG_DB_NAME, MYF(0), new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); if (force_switch) mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server); @@ -1682,7 +1681,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) new_db_file_name.str); general_log_print(thd, COM_INIT_DB, ER(ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->priv_host, new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); DBUG_RETURN(TRUE); } #endif @@ -1697,7 +1696,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); /* Change db to NULL. */ @@ -1712,7 +1711,7 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch) /* Report an error and free new_db_file_name. */ my_error(ER_BAD_DB_ERROR, MYF(0), new_db_file_name.str); - my_free(new_db_file_name.str, MYF(0)); + my_free(new_db_file_name.str); /* The operation failed. */ diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index d6f2a472e05..06a453f7b12 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -109,7 +109,7 @@ static char *mysql_ha_hash_get_key(TABLE_LIST *tables, size_t *key_len_p, static void mysql_ha_hash_free(TABLE_LIST *tables) { - my_free((char*) tables, MYF(0)); + my_free(tables); } /** @@ -259,7 +259,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen) /* add to hash */ if (my_hash_insert(&thd->handler_tables_hash, (uchar*) hash_tables)) { - my_free((char*) hash_tables, MYF(0)); + my_free(hash_tables); DBUG_PRINT("exit",("ERROR")); DBUG_RETURN(TRUE); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 24a418f8f25..c783d74b363 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -93,7 +93,7 @@ static bool check_view_insertability(THD *thd, TABLE_LIST *view); #define my_safe_afree(ptr, size, min_length) my_afree(ptr) #else #define my_safe_alloca(size, min_length) ((size <= min_length) ? my_alloca(size) : my_malloc(size,MYF(0))) -#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr,MYF(0)) +#define my_safe_afree(ptr, size, min_length) if (size > min_length) my_free(ptr) #endif /* @@ -1779,8 +1779,8 @@ public: {} ~delayed_row() { - x_free(query.str); - x_free(record); + my_free(query.str); + my_free(record); } }; @@ -1868,7 +1868,7 @@ public: mysql_cond_destroy(&cond); mysql_cond_destroy(&cond_client); thd.unlink(); // Must be unlinked under lock - x_free(thd.query()); + my_free(thd.query()); thd.security_ctx->user= thd.security_ctx->host=0; thread_count--; delayed_insert_threads--; @@ -2276,7 +2276,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, row= new delayed_row(query, duplic, ignore, log_on); if (row == NULL) { - my_free(query.str, MYF(MY_WME)); + my_free(query.str); goto err; } @@ -2680,7 +2680,7 @@ static void free_delayed_insert_blobs(register TABLE *table) { uchar *str; ((Field_blob *) (*ptr))->get_ptr(&str); - my_free(str,MYF(MY_ALLOW_ZERO_PTR)); + my_free(str); ((Field_blob *) (*ptr))->reset(); } } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5f8b1148dcb..aefddc0b6a5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -457,8 +457,8 @@ Yacc_state::~Yacc_state() { if (yacc_yyss) { - my_free(yacc_yyss, MYF(0)); - my_free(yacc_yyvs, MYF(0)); + my_free(yacc_yyss); + my_free(yacc_yyvs); } } diff --git a/sql/sql_list.h b/sql/sql_list.h index d57534b0999..cc42fcae91b 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -534,7 +534,7 @@ struct ilink } static void operator delete(void* ptr_arg, size_t size) { - my_free((uchar*)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + my_free(ptr_arg); } inline ilink() diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 7e540ffbe4b..9a5792407b1 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -1337,7 +1337,7 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs, (is_fifo ? READ_FIFO : READ_CACHE),0L,1, MYF(MY_WME))) { - my_free((uchar*) buffer,MYF(0)); /* purecov: inspected */ + my_free(buffer); /* purecov: inspected */ error=1; } else @@ -1368,7 +1368,7 @@ READ_INFO::~READ_INFO() { if (need_end_io_cache) ::end_io_cache(&cache); - my_free((uchar*) buffer,MYF(0)); + my_free(buffer); error=1; } List_iterator<XML_TAG> xmlit(taglist); diff --git a/sql/sql_locale.cc b/sql/sql_locale.cc index abd9c395083..c8aee307362 100644 --- a/sql/sql_locale.cc +++ b/sql/sql_locale.cc @@ -3442,6 +3442,6 @@ void cleanup_errmsgs() { for (MY_LOCALE_ERRMSGS *msgs= global_errmsgs; msgs->language; msgs++) { - my_free(msgs->errmsgs, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + my_free(msgs->errmsgs); } } diff --git a/sql/sql_manager.cc b/sql/sql_manager.cc index 2189b1e124f..e3929066361 100644 --- a/sql/sql_manager.cc +++ b/sql/sql_manager.cc @@ -117,7 +117,7 @@ pthread_handler_t handle_manager(void *arg __attribute__((unused))) { struct handler_cb *next= cb->next; cb->action(); - my_free((uchar*)cb, MYF(0)); + my_free(cb); cb= next; } } diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 35a248e5465..ca8a88bcbf8 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -74,7 +74,7 @@ mapped_files::~mapped_files() (void) mysql_file_close(file, MYF(0)); file= -1; map=0; } - my_free(name,MYF(0)); + my_free(name); #endif } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b48491577d1..a7d538dd3e8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1058,7 +1058,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (res) { - x_free(thd->security_ctx->user); + my_free(thd->security_ctx->user); *thd->security_ctx= save_security_ctx; thd->user_connect= save_user_connect; thd->db= save_db; @@ -1071,8 +1071,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (save_user_connect) decrease_user_connections(save_user_connect); #endif /* NO_EMBEDDED_ACCESS_CHECKS */ - x_free(save_db); - x_free(save_security_ctx.user); + my_free(save_db); + my_free(save_security_ctx.user); if (cs_number) { @@ -1415,18 +1415,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #ifdef EMBEDDED_LIBRARY /* Store the buffer in permanent memory */ my_ok(thd, 0, 0, buff); -#endif -#ifdef SAFEMALLOC - if (sf_malloc_cur_memory) // Using SAFEMALLOC - { - char *end= buff + length; - length+= my_snprintf(end, buff_len - length - 1, - end," Memory in use: %ldK Max memory used: %ldK", - (sf_malloc_cur_memory+1023L)/1024L, - (sf_malloc_max_memory+1023L)/1024L); - } -#endif -#ifndef EMBEDDED_LIBRARY +#else (void) my_net_write(net, (uchar*) buff, length); (void) net_flush(net); thd->stmt_da->disable_status(); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index bc9a7d8ee65..d7ff753dfd0 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2624,7 +2624,7 @@ char *generate_partition_syntax(partition_info *part_info, if (unlikely(mysql_file_read(fptr, (uchar*)buf, *buf_length, MYF(MY_FNABP)))) { if (!use_sql_alloc) - my_free(buf, MYF(0)); + my_free(buf); else buf= NULL; } diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 97c480ea0bd..2b6be403fc6 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -254,10 +254,9 @@ static void plugin_vars_free_values(sys_var *vars); static void restore_pluginvar_names(sys_var *first); static void plugin_opt_set_limits(struct my_option *, const struct st_mysql_sys_var *); -#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B CALLER_INFO) -#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B ORIG_CALLER_INFO) -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin - CALLER_INFO_PROTO); +#define my_intern_plugin_lock(A,B) intern_plugin_lock(A,B) +#define my_intern_plugin_lock_ci(A,B) intern_plugin_lock(A,B) +static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref plugin); static void intern_plugin_unlock(LEX *lex, plugin_ref plugin); static void reap_plugins(void); @@ -392,9 +391,9 @@ static inline void free_plugin_mem(struct st_plugin_dl *p) if (p->handle) dlclose(p->handle); #endif - my_free(p->dl.str, MYF(MY_ALLOW_ZERO_PTR)); + my_free(p->dl.str); if (p->version != MYSQL_PLUGIN_INTERFACE_VERSION) - my_free((uchar*)p->plugins, MYF(MY_ALLOW_ZERO_PTR)); + my_free(p->plugins); } @@ -660,7 +659,7 @@ SHOW_COMP_OPTION plugin_status(const char *name, int len, size_t type) } -static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO) +static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc) { st_plugin_int *pi= plugin_ref_to_int(rc); DBUG_ENTER("intern_plugin_lock"); @@ -682,7 +681,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO) memory manager and/or valgrind to track locked references and double unlocks to aid resolving reference counting problems. */ - if (!(plugin= (plugin_ref) my_malloc_ci(sizeof(pi), MYF(MY_WME)))) + if (!(plugin= (plugin_ref) my_malloc(sizeof(pi), MYF(MY_WME)))) DBUG_RETURN(NULL); *plugin= pi; @@ -699,7 +698,7 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc CALLER_INFO_PROTO) } -plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO) +plugin_ref plugin_lock(THD *thd, plugin_ref *ptr) { LEX *lex= thd ? thd->lex : 0; plugin_ref rc; @@ -711,8 +710,7 @@ plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO) } -plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type - CALLER_INFO_PROTO) +plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, int type) { LEX *lex= thd ? thd->lex : 0; plugin_ref rc= NULL; @@ -973,7 +971,7 @@ static void intern_plugin_unlock(LEX *lex, plugin_ref plugin) if (!pi->plugin_dl) DBUG_VOID_RETURN; #else - my_free((uchar*) plugin, MYF(MY_WME)); + my_free(plugin); #endif DBUG_PRINT("info",("unlocking plugin, name= %s, ref_count= %d", @@ -2245,7 +2243,7 @@ static void update_func_str(THD *thd, struct st_mysql_sys_var *var, if (var->flags & PLUGIN_VAR_MEMALLOC) { *(char **)tgt= my_strdup(*(char **) save, MYF(0)); - my_free(old, MYF(0)); + my_free(old); } } @@ -2637,7 +2635,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars) flags & PLUGIN_VAR_THDLOCAL && flags & PLUGIN_VAR_MEMALLOC) { char **ptr= (char**) pivar->real_value_ptr(thd, OPT_SESSION); - my_free(*ptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + my_free(*ptr); *ptr= NULL; } } @@ -2645,7 +2643,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars) DBUG_ASSERT(vars->table_plugin == NULL); - my_free(vars->dynamic_variables_ptr, MYF(MY_ALLOW_ZERO_PTR)); + my_free(vars->dynamic_variables_ptr); vars->dynamic_variables_ptr= NULL; vars->dynamic_variables_size= 0; vars->dynamic_variables_version= 0; @@ -2706,7 +2704,7 @@ static void plugin_vars_free_values(sys_var *vars) char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL); DBUG_PRINT("plugin", ("freeing value for: '%s' addr: 0x%lx", var->name.str, (long) valptr)); - my_free(*valptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + my_free(*valptr); *valptr= NULL; } } diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index e7ecca029b9..079dc4e6dca 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -30,8 +30,6 @@ #include "m_string.h" /* LEX_STRING */ #include "my_alloc.h" /* MEM_ROOT */ -#include "my_sys.h" /* CALLER_INFO_PROTO */ - class sys_var; enum SHOW_COMP_OPTION { SHOW_OPTION_YES, SHOW_OPTION_NO, SHOW_OPTION_DISABLED}; @@ -134,13 +132,13 @@ extern int plugin_init(int *argc, char **argv, int init_flags); extern void plugin_shutdown(void); void add_plugin_options(DYNAMIC_ARRAY *options, MEM_ROOT *mem_root); extern bool plugin_is_ready(const LEX_STRING *name, int type); -#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO) -#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO) -#define my_plugin_lock(A,B) plugin_lock(A,B CALLER_INFO) -#define my_plugin_lock_ci(A,B) plugin_lock(A,B ORIG_CALLER_INFO) -extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr CALLER_INFO_PROTO); +#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C) +#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C) +#define my_plugin_lock(A,B) plugin_lock(A,B) +#define my_plugin_lock_ci(A,B) plugin_lock(A,B) +extern plugin_ref plugin_lock(THD *thd, plugin_ref *ptr); extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name, - int type CALLER_INFO_PROTO); + int type); extern void plugin_unlock(THD *thd, plugin_ref plugin); extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count); extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name, diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 4a0d3d944ad..ce3d786cf92 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -177,8 +177,7 @@ PROF_MEASUREMENT::PROF_MEASUREMENT(QUERY_PROFILE *profile_arg, PROF_MEASUREMENT::~PROF_MEASUREMENT() { - if (allocated_status_memory != NULL) - my_free(allocated_status_memory, MYF(0)); + my_free(allocated_status_memory); status= function= file= NULL; } @@ -268,8 +267,7 @@ QUERY_PROFILE::~QUERY_PROFILE() while (! entries.is_empty()) delete entries.pop(); - if (query_source != NULL) - my_free(query_source, MYF(0)); + my_free(query_source); } /** diff --git a/sql/sql_profile.h b/sql/sql_profile.h index ff16a2da19b..7d17dc69b88 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -82,7 +82,7 @@ public: for (i= first; i != NULL; i= after_i) { after_i= i->next; - my_free((char *) i, MYF(0)); + my_free(i); } elements= 0; } @@ -129,7 +129,7 @@ public: last= NULL; first= first->next; - my_free((char *)old_item, MYF(0)); + my_free(old_item); elements--; return ret; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 22190eeefed..24d2a21147c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6957,7 +6957,7 @@ void JOIN_TAB::cleanup() select= 0; delete quick; quick= 0; - x_free(cache.buff); + my_free(cache.buff); cache.buff= 0; limit= 0; if (table) @@ -14251,7 +14251,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, if (my_hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0, key_length, (my_hash_get_key) 0, 0, 0)) { - my_free((char*) key_buffer,MYF(0)); + my_free(key_buffer); DBUG_RETURN(1); } @@ -14303,14 +14303,14 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, } key_pos+=extra_length; } - my_free((char*) key_buffer,MYF(0)); + my_free(key_buffer); my_hash_free(&hash); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); DBUG_RETURN(0); err: - my_free((char*) key_buffer,MYF(0)); + my_free(key_buffer); my_hash_free(&hash); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); @@ -14393,7 +14393,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) sizeof(CACHE_FIELD*)))) { - my_free((uchar*) cache->buff,MYF(0)); /* purecov: inspected */ + my_free(cache->buff); /* purecov: inspected */ cache->buff=0; /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f1d7e48ffcc..fc2f22f6f48 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1353,7 +1353,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN(" /*!50100 TABLESPACE ")); packet->append(for_str, strlen(for_str)); packet->append(STRING_WITH_LEN(" STORAGE DISK */")); - my_free(for_str, MYF(0)); + my_free(for_str); } /* @@ -1495,7 +1495,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, table->part_info->set_show_version_string(packet); packet->append(part_syntax, part_syntax_len); packet->append(STRING_WITH_LEN(" */")); - my_free(part_syntax, MYF(0)); + my_free(part_syntax); } } #endif @@ -3323,7 +3323,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables, res= schema_table->process_table(thd, &table_list, table, res, db_name, table_name); free_root(&tbl.mem_root, MYF(0)); - my_free((char*) tbl.alias, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void *) tbl.alias); } end_share: @@ -5375,7 +5375,7 @@ static void store_schema_partitions_record(THD *thd, TABLE *schema_table, if(ts) { table->field[24]->store(ts, strlen(ts), cs); - my_free(ts, MYF(0)); + my_free(ts); } else table->field[24]->set_null(); @@ -7470,7 +7470,7 @@ int initialize_schema_table(st_plugin_int *plugin) sql_print_error("Plugin '%s' init function returned error.", plugin->name.str); plugin->data= NULL; - my_free(schema_table, MYF(0)); + my_free(schema_table); DBUG_RETURN(1); } @@ -7493,7 +7493,7 @@ int finalize_schema_table(st_plugin_int *plugin) DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", plugin->name.str)); } - my_free(schema_table, MYF(0)); + my_free(schema_table); } DBUG_RETURN(0); } diff --git a/sql/sql_string.h b/sql/sql_string.h index debfb7aa9c6..0ce67108423 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -205,7 +205,7 @@ public: { alloced=0; Alloced_length=0; - my_free(Ptr,MYF(0)); + my_free(Ptr); Ptr=0; str_length=0; /* Safety */ } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f300ecec2c6..fa9f9b7f633 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1534,13 +1534,13 @@ void release_ddl_log() while (used_list) { DDL_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry; - my_free(used_list, MYF(0)); + my_free(used_list); used_list= tmp; } while (free_list) { DDL_LOG_MEMORY_ENTRY *tmp= free_list->next_log_entry; - my_free(free_list, MYF(0)); + my_free(free_list); free_list= tmp; } close_ddl_log(); @@ -1696,8 +1696,8 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) if (readfrm(shadow_path, &data, &length) || packfrm(data, length, &lpt->pack_frm_data, &lpt->pack_frm_len)) { - my_free(data, MYF(MY_ALLOW_ZERO_PTR)); - my_free(lpt->pack_frm_data, MYF(MY_ALLOW_ZERO_PTR)); + my_free(data); + my_free(lpt->pack_frm_data); mem_alloc_error(length); error= 1; goto end; @@ -7534,7 +7534,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (t_table) { intern_close_table(t_table); - my_free(t_table, MYF(0)); + my_free(t_table); } else sql_print_warning("Could not open table %s.%s after rename\n", diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 48fd5f9dff8..501c4cf6a94 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -555,11 +555,6 @@ Next alarm time: %lu\n", #endif display_table_locks(); fflush(stdout); - my_checkmalloc(); - fprintf(stdout,"\nBegin safemalloc memory dump:\n"); // tag needed for test suite - TERMINATE(stdout, 1); // Write malloc information - fprintf(stdout,"\nEnd safemalloc memory dump.\n"); - fflush(stdout); #ifdef HAVE_MALLINFO struct mallinfo info= mallinfo(); printf("\nMemory status:\n\ diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 901ab8e987d..c2482ef1ce0 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -216,7 +216,7 @@ static bool recreate_temporary_table(THD *thd, TABLE *table) rm_temporary_table(table_type, share->path.str); free_table_share(share); - my_free(table, MYF(0)); + my_free(table); DBUG_RETURN(error); } diff --git a/sql/sys_vars.h b/sql/sys_vars.h index fbc48573487..18c073b1e90 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -388,7 +388,7 @@ public: ~Sys_var_charptr() { if (flags & ALLOCATED) - my_free(global_var(char*), MYF(MY_ALLOW_ZERO_PTR)); + my_free(global_var(char*)); flags&= ~ALLOCATED; } bool do_check(THD *thd, set_var *var) @@ -435,7 +435,7 @@ public: else new_val= 0; if (flags & ALLOCATED) - my_free(global_var(char*), MYF(MY_ALLOW_ZERO_PTR)); + my_free(global_var(char*)); flags|= ALLOCATED; global_var(char*)= new_val; return false; diff --git a/sql/table.cc b/sql/table.cc index 4e6f2ae2860..a58623f0036 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -896,7 +896,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (mysql_file_pread(file, buff, n_length, record_offset + share->reclength, MYF(MY_NABP))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } share->connect_string.length= uint2korr(buff); @@ -905,7 +905,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->connect_string. length))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } next_chunk+= share->connect_string.length + 2; @@ -926,7 +926,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, plugin_data(tmp_plugin, handlerton *))) { /* bad file, legacy_db_type did not match the name */ - my_free(buff, MYF(0)); + my_free(buff); goto err; } /* @@ -956,7 +956,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, error= 8; my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-partition"); - my_free(buff, MYF(0)); + my_free(buff); goto err; } plugin_unlock(NULL, share->db_plugin); @@ -972,7 +972,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, error= 8; name.str[name.length]=0; my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name.str); - my_free(buff, MYF(0)); + my_free(buff); goto err; /* purecov: end */ } @@ -989,7 +989,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, memdup_root(&share->mem_root, next_chunk + 4, partition_info_str_len + 1))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } } @@ -997,7 +997,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (partition_info_str_len) { DBUG_PRINT("info", ("WITH_PARTITION_STORAGE_ENGINE is not defined")); - my_free(buff, MYF(0)); + my_free(buff); goto err; } #endif @@ -1035,7 +1035,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, { DBUG_PRINT("error", ("fulltext key uses parser that is not defined in .frm")); - my_free(buff, MYF(0)); + my_free(buff); goto err; } parser_name.str= (char*) next_chunk; @@ -1046,7 +1046,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (! keyinfo->parser) { my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), parser_name.str); - my_free(buff, MYF(0)); + my_free(buff); goto err; } } @@ -1058,19 +1058,19 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, { DBUG_PRINT("error", ("long table comment is not defined in .frm")); - my_free(buff, MYF(0)); + my_free(buff); goto err; } share->comment.length = uint2korr(next_chunk); if (! (share->comment.str= strmake_root(&share->mem_root, (char*)next_chunk + 2, share->comment.length))) { - my_free(buff, MYF(0)); + my_free(buff); goto err; } next_chunk+= 2 + share->comment.length; } - my_free(buff, MYF(0)); + my_free(buff); } share->key_block_size= uint2korr(head+62); @@ -1586,7 +1586,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, } else share->primary_key= MAX_KEY; - x_free((uchar*) disk_buff); + my_free(disk_buff); disk_buff=0; if (new_field_pack_flag <= 1) { @@ -1658,7 +1658,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, share->error= error; share->open_errno= my_errno; share->errarg= errarg; - x_free((uchar*) disk_buff); + my_free(disk_buff); delete crypted; delete handler_file; my_hash_free(&share->name_hash); @@ -2010,7 +2010,7 @@ partititon_err: outparam->file= 0; // For easier error checking outparam->db_stat=0; free_root(&outparam->mem_root, MYF(0)); // Safe to call on bzero'd root - my_free((char*) outparam->alias, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void *) outparam->alias); DBUG_RETURN (error); } @@ -2032,7 +2032,7 @@ int closefrm(register TABLE *table, bool free_share) if (table->db_stat) error=table->file->close(); - my_free((char*) table->alias, MYF(MY_ALLOW_ZERO_PTR)); + my_free((void *) table->alias); table->alias= 0; if (table->field) { @@ -2127,14 +2127,14 @@ static ulong get_form_pos(File file, uchar *head) if (mysql_file_read(file, buf, length+names*4, MYF(MY_NABP))) { - x_free(buf); + my_free(buf); DBUG_RETURN(0); } pos= buf+length; ret_value= uint4korr(pos); - my_free(buf, MYF(0)); + my_free(buf); DBUG_RETURN(ret_value); } @@ -2151,11 +2151,11 @@ int read_string(File file, uchar**to, size_t length) { DBUG_ENTER("read_string"); - x_free(*to); + my_free(*to); if (!(*to= (uchar*) my_malloc(length+1,MYF(MY_WME))) || mysql_file_read(file, *to, length, MYF(MY_NABP))) { - x_free(*to); /* purecov: inspected */ + my_free(*to); /* purecov: inspected */ *to= 0; /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } diff --git a/sql/uniques.cc b/sql/uniques.cc index 7b5a6d1ce4f..690b310bde5 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -566,7 +566,7 @@ bool Unique::walk(tree_walk_action action, void *walk_action_arg) (BUFFPEK *) file_ptrs.buffer + file_ptrs.elements, action, walk_action_arg, tree.compare, tree.custom_arg, &file); - my_free((char*) merge_buffer, MYF(0)); + my_free(merge_buffer); return res; } @@ -642,7 +642,7 @@ bool Unique::get(TABLE *table) goto err; error=0; err: - x_free(sort_buffer); + my_free(sort_buffer); if (flush_io_cache(outfile)) error=1; diff --git a/sql/unireg.cc b/sql/unireg.cc index 802e5b7429c..6433b8bc7c2 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -148,7 +148,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, if (error) { - my_free(screen_buff, MYF(0)); + my_free(screen_buff); if (! pack_header_error_handler.is_handled) DBUG_RETURN(1); @@ -159,7 +159,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, create_fields,info_length, screens, create_info->table_options, data_offset, db_file)) { - my_free(screen_buff, MYF(0)); + my_free(screen_buff); DBUG_RETURN(1); } } @@ -228,7 +228,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, { my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), real_table_name, (uint) TABLE_COMMENT_MAXLEN); - my_free(screen_buff,MYF(0)); + my_free(screen_buff); DBUG_RETURN(1); } char warn_buff[MYSQL_ERRMSG_SIZE]; @@ -259,7 +259,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo, create_info, keys, key_info)) < 0) { - my_free(screen_buff, MYF(0)); + my_free(screen_buff); DBUG_RETURN(1); } @@ -374,15 +374,15 @@ bool mysql_create_frm(THD *thd, const char *file_name, delete crypted; if (mysql_file_pwrite(file, disk_buff, read_length, filepos+256, MYF_RW)) { - my_free(disk_buff,MYF(0)); + my_free(disk_buff); goto err; } - my_free(disk_buff,MYF(0)); + my_free(disk_buff); } #endif - my_free(screen_buff,MYF(0)); - my_free(keybuff, MYF(0)); + my_free(screen_buff); + my_free(keybuff); if (opt_sync_frm && !(create_info->options & HA_LEX_CREATE_TMP_TABLE) && (mysql_file_sync(file, MYF(MY_WME)) || @@ -411,8 +411,8 @@ bool mysql_create_frm(THD *thd, const char *file_name, DBUG_RETURN(0); err: - my_free(screen_buff, MYF(0)); - my_free(keybuff, MYF(0)); + my_free(screen_buff); + my_free(keybuff); err2: (void) mysql_file_close(file, MYF(MY_WME)); err3: @@ -1095,7 +1095,7 @@ static bool make_empty_rec(THD *thd, File file,enum legacy_db_type table_type, error= mysql_file_write(file, buff, (size_t) reclength, MYF_RW) != 0; err: - my_free(buff, MYF(MY_FAE)); + my_free(buff); thd->count_cuted_fields= old_count_cuted_fields; DBUG_RETURN(error); } /* make_empty_rec */ |