Skip to content

Commit 86160e3

Browse files
Davi ArnautDavi Arnaut
Davi Arnaut
authored and
Davi Arnaut
committed
Merge of mysql-trunk-bugfixing into mysql-next-mr-bugfixing.
2 parents 0fb2db1 + a10ae35 commit 86160e3

File tree

218 files changed

+1013
-1822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+1013
-1822
lines changed

BUILD/SETUP.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ fi
122122
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
123123
# LINT_INIT(), which is only useful for silencing spurious warnings
124124
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
125-
valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
125+
valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
126126
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
127127
valgrind_configs="--with-valgrind"
128128
#
129129
# Used in -debug builds
130130
debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
131-
debug_cflags="$debug_cflags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC -DSAFE_MUTEX"
131+
debug_cflags="$debug_cflags -DSAFE_MUTEX"
132132
error_inject="--with-error-inject "
133133
#
134134
# Base C++ flags for all builds

BUILD/build_mccge.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ set_ccache_usage()
10101010
set_valgrind_flags()
10111011
{
10121012
if test "x$valgrind_flag" = "xyes" ; then
1013-
loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
1013+
loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
10141014
loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
10151015
compiler_flags="$compiler_flags $loc_valgrind_flags"
10161016
with_flags="$with_flags --with-valgrind"
@@ -1066,7 +1066,7 @@ set_with_debug_flags()
10661066
if test "x$with_debug_flag" = "xyes" ; then
10671067
if test "x$developer_flag" = "xyes" ; then
10681068
loc_debug_flags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "
1069-
loc_debug_flags="$loc_debug_flags -DSAFEMALLOC -DPEDANTIC_SAFEMALLOC"
1069+
loc_debug_flags="$loc_debug_flags"
10701070
compiler_flags="$compiler_flags $loc_debug_flags"
10711071
fi
10721072
fi

BUILD/compile-ia64-debug-max

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ gmake -k maintainer-clean || true
44
path=`dirname $0`
55
. "$path/autorun.sh"
66

7-
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFEMALLOC -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
7+
CC=ecc CFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" CXX=ecc CXXFLAGS="-w1 -DEXTRA_DEBUG -DSAFE_MUTEX -O2" ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-debug --with-innodb --with-embedded-server --with-archive-storage-engine
88
gmake

CMakeLists.txt

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ENDIF()
3434
SET(CUSTOM_C_FLAGS $ENV{CFLAGS})
3535

3636
OPTION(WITH_DEBUG "Use dbug/safemutex" OFF)
37-
OPTION(WITH_DEBUG_FULL "Use dbug and safemalloc/safemutex. Slow" OFF)
37+
OPTION(WITH_DEBUG_FULL "Use dbug and safemutex. Slow." OFF)
3838

3939
# Distinguish between community and non-community builds, with the
4040
# default being a community build. This does not impact the feature
@@ -175,14 +175,13 @@ IF(NOT CMAKE_BUILD_TYPE
175175
ENDIF()
176176
ENDIF()
177177

178-
# Add safemalloc and safemutex for debug condifurations, except on Windows
179-
# (C runtime library provides safemalloc functionality and safemutex has never
180-
# worked there)
178+
# Add safemutex for debug configurations, except on Windows
179+
# (safemutex has never worked on Windows)
181180
IF(WITH_DEBUG OR WITH_DEBUG_FULL AND NOT WIN32)
182181
FOREACH(LANG C CXX)
183182
IF(WITH_DEBUG_FULL)
184183
SET(CMAKE_${LANG}_FLAGS_DEBUG
185-
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
184+
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")
186185
ELSE()
187186
SET(CMAKE_${LANG}_FLAGS_DEBUG
188187
"${CMAKE_${LANG}_FLAGS_DEBUG} -DSAFE_MUTEX")

client/completion_hash.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
#include <my_global.h>
2424
#include <m_string.h>
25-
#undef SAFEMALLOC // Speed things up
2625
#include <my_sys.h>
2726
#include "completion_hash.h"
2827

@@ -213,7 +212,7 @@ void completion_hash_clean(HashTable *ht)
213212
void completion_hash_free(HashTable *ht)
214213
{
215214
completion_hash_clean(ht);
216-
my_free(ht->arBuckets, MYF(0));
215+
my_free(ht->arBuckets);
217216
}
218217

219218

client/mysql.cc

+24-24
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ int main(int argc,char *argv[])
12051205
strncmp(link_name, "/dev/null", 10) == 0)
12061206
{
12071207
/* The .mysql_history file is a symlink to /dev/null, don't use it */
1208-
my_free(histfile, MYF(MY_ALLOW_ZERO_PTR));
1208+
my_free(histfile);
12091209
histfile= 0;
12101210
}
12111211
}
@@ -1266,23 +1266,23 @@ sig_handler mysql_end(int sig)
12661266
glob_buffer.free();
12671267
old_buffer.free();
12681268
processed_prompt.free();
1269-
my_free(server_version,MYF(MY_ALLOW_ZERO_PTR));
1270-
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
1271-
my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR));
1272-
my_free(histfile,MYF(MY_ALLOW_ZERO_PTR));
1273-
my_free(histfile_tmp,MYF(MY_ALLOW_ZERO_PTR));
1274-
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
1275-
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
1276-
my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
1277-
my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
1278-
my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
1279-
my_free(default_prompt,MYF(MY_ALLOW_ZERO_PTR));
1269+
my_free(server_version);
1270+
my_free(opt_password);
1271+
my_free(opt_mysql_unix_port);
1272+
my_free(histfile);
1273+
my_free(histfile_tmp);
1274+
my_free(current_db);
1275+
my_free(current_host);
1276+
my_free(current_user);
1277+
my_free(full_username);
1278+
my_free(part_username);
1279+
my_free(default_prompt);
12801280
#ifdef HAVE_SMEM
1281-
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
1281+
my_free(shared_memory_base_name);
12821282
#endif
1283-
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
1283+
my_free(current_prompt);
12841284
while (embedded_server_arg_count > 1)
1285-
my_free(embedded_server_args[--embedded_server_arg_count],MYF(0));
1285+
my_free(embedded_server_args[--embedded_server_arg_count]);
12861286
mysql_server_end();
12871287
free_defaults(defaults_argv);
12881288
my_end(my_end_arg);
@@ -1736,7 +1736,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
17361736
if (argument)
17371737
{
17381738
char *start= argument;
1739-
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
1739+
my_free(opt_password);
17401740
opt_password= my_strdup(argument, MYF(MY_FAE));
17411741
while (*argument) *argument++= 'x'; // Destroy argument
17421742
if (*start)
@@ -1833,7 +1833,7 @@ static int get_options(int argc, char **argv)
18331833
if (argc == 1)
18341834
{
18351835
skip_updates= 0;
1836-
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
1836+
my_free(current_db);
18371837
current_db= my_strdup(*argv, MYF(MY_WME));
18381838
}
18391839
if (tty_password)
@@ -2731,7 +2731,7 @@ static void get_current_db()
27312731
{
27322732
MYSQL_RES *res;
27332733

2734-
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
2734+
my_free(current_db);
27352735
current_db= NULL;
27362736
/* In case of error below current_db will be NULL */
27372737
if (!mysql_query(&mysql, "SELECT DATABASE()") &&
@@ -4023,12 +4023,12 @@ com_connect(String *buffer, char *line)
40234023
tmp= get_arg(buff, 0);
40244024
if (tmp && *tmp)
40254025
{
4026-
my_free(current_db, MYF(MY_ALLOW_ZERO_PTR));
4026+
my_free(current_db);
40274027
current_db= my_strdup(tmp, MYF(MY_WME));
40284028
tmp= get_arg(buff, 1);
40294029
if (tmp)
40304030
{
4031-
my_free(current_host,MYF(MY_ALLOW_ZERO_PTR));
4031+
my_free(current_host);
40324032
current_host=my_strdup(tmp,MYF(MY_WME));
40334033
}
40344034
}
@@ -4200,7 +4200,7 @@ com_use(String *buffer __attribute__((unused)), char *line)
42004200
if (mysql_select_db(&mysql,tmp))
42014201
return put_error(&mysql);
42024202
}
4203-
my_free(current_db,MYF(MY_ALLOW_ZERO_PTR));
4203+
my_free(current_db);
42044204
current_db=my_strdup(tmp,MYF(MY_WME));
42054205
#ifdef HAVE_READLINE
42064206
if (select_db > 1)
@@ -4952,8 +4952,8 @@ static void add_int_to_prompt(int toadd)
49524952

49534953
static void init_username()
49544954
{
4955-
my_free(full_username,MYF(MY_ALLOW_ZERO_PTR));
4956-
my_free(part_username,MYF(MY_ALLOW_ZERO_PTR));
4955+
my_free(full_username);
4956+
my_free(part_username);
49574957

49584958
MYSQL_RES *result;
49594959
LINT_INIT(result);
@@ -4971,7 +4971,7 @@ static int com_prompt(String *buffer, char *line)
49714971
{
49724972
char *ptr=strchr(line, ' ');
49734973
prompt_counter = 0;
4974-
my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
4974+
my_free(current_prompt);
49754975
current_prompt=my_strdup(ptr ? ptr+1 : default_prompt,MYF(MY_WME));
49764976
if (!ptr)
49774977
tee_fprintf(stdout, "Returning to default PROMPT of %s\n", default_prompt);

client/mysqladmin.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
236236
if (argument)
237237
{
238238
char *start=argument;
239-
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
239+
my_free(opt_password);
240240
opt_password=my_strdup(argument,MYF(MY_FAE));
241241
while (*argument) *argument++= 'x'; /* Destroy argument */
242242
if (*start)
@@ -448,10 +448,10 @@ int main(int argc,char *argv[])
448448
} /* got connection */
449449

450450
mysql_close(&mysql);
451-
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
452-
my_free(user,MYF(MY_ALLOW_ZERO_PTR));
451+
my_free(opt_password);
452+
my_free(user);
453453
#ifdef HAVE_SMEM
454-
my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
454+
my_free(shared_memory_base_name);
455455
#endif
456456
free_defaults(save_argv);
457457
my_end(my_end_arg);
@@ -1008,8 +1008,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
10081008
/* free up memory from prompted password */
10091009
if (typed_password != argv[1])
10101010
{
1011-
my_free(typed_password,MYF(MY_ALLOW_ZERO_PTR));
1012-
my_free(verified,MYF(MY_ALLOW_ZERO_PTR));
1011+
my_free(typed_password);
1012+
my_free(verified);
10131013
}
10141014
argc--; argv++;
10151015
break;

client/mysqlbinlog.cc

+18-18
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,23 @@ TYPELIB base64_output_mode_typelib=
7171
{ array_elements(base64_output_mode_names) - 1, "",
7272
base64_output_mode_names, NULL };
7373
static enum_base64_output_mode opt_base64_output_mode= BASE64_OUTPUT_UNSPEC;
74-
static const char *opt_base64_output_mode_str= NullS;
75-
static const char* database= 0;
76-
static const char* output_file= 0;
74+
static char *opt_base64_output_mode_str= 0;
75+
static char *database= 0;
76+
static char *output_file= 0;
7777
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
7878
static my_bool debug_info_flag, debug_check_flag;
7979
static my_bool force_if_open_opt= 1, raw_mode= 0;
8080
static my_bool to_last_remote_log= 0, stop_never= 0;
8181
static ulonglong offset = 0;
8282
static uint stop_never_server_id= 1;
83-
static const char* host = 0;
83+
static char* host = 0;
8484
static int port= 0;
8585
static uint my_end_arg;
8686
static const char* sock= 0;
8787
#ifdef HAVE_SMEM
8888
static char *shared_memory_base_name= 0;
8989
#endif
90-
static const char* user = 0;
90+
static char* user = 0;
9191
static char* pass = 0;
9292
static char *charset= 0;
9393

@@ -102,7 +102,7 @@ static my_time_t start_datetime= 0, stop_datetime= MY_TIME_T_MAX;
102102
static ulonglong rec_count= 0;
103103
static short binlog_flags = 0;
104104
static MYSQL* mysql = NULL;
105-
static const char* dirname_for_local_load= 0;
105+
static char* dirname_for_local_load= 0;
106106

107107
/**
108108
Pointer to the Format_description_log_event of the currently active binlog.
@@ -196,7 +196,7 @@ class Load_log_processor
196196
int init()
197197
{
198198
return init_dynamic_array(&file_names, sizeof(File_name_record),
199-
100,100 CALLER_INFO);
199+
100, 100);
200200
}
201201

202202
void init_by_dir_name(const char *dir)
@@ -218,7 +218,7 @@ class Load_log_processor
218218
{
219219
if (ptr->fname)
220220
{
221-
my_free(ptr->fname, MYF(MY_WME));
221+
my_free(ptr->fname);
222222
delete ptr->event;
223223
bzero((char *)ptr, sizeof(File_name_record));
224224
}
@@ -447,7 +447,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
447447
{
448448
error("Could not construct local filename %s%s.",
449449
target_dir_name,bname);
450-
my_free(fname, MYF(0));
450+
my_free(fname);
451451
delete ce;
452452
DBUG_RETURN(ERROR_STOP);
453453
}
@@ -463,7 +463,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname,
463463
if (set_dynamic(&file_names, (uchar*)&rec, file_id))
464464
{
465465
error("Out of memory.");
466-
my_free(fname, MYF(0));
466+
my_free(fname);
467467
delete ce;
468468
DBUG_RETURN(ERROR_STOP);
469469
}
@@ -827,7 +827,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
827827
*/
828828
convert_path_to_forward_slashes((char*) ce->fname);
829829
ce->print(result_file, print_event_info, TRUE);
830-
my_free((char*)ce->fname,MYF(MY_WME));
830+
my_free((void*)ce->fname);
831831
delete ce;
832832
}
833833
else
@@ -892,7 +892,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
892892
}
893893

894894
if (fname)
895-
my_free(fname, MYF(MY_WME));
895+
my_free(fname);
896896
break;
897897
}
898898
case TABLE_MAP_EVENT:
@@ -1253,11 +1253,11 @@ static void warning(const char *format,...)
12531253
*/
12541254
static void cleanup()
12551255
{
1256-
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
1257-
my_free((char*) database, MYF(MY_ALLOW_ZERO_PTR));
1258-
my_free((char*) host, MYF(MY_ALLOW_ZERO_PTR));
1259-
my_free((char*) user, MYF(MY_ALLOW_ZERO_PTR));
1260-
my_free((char*) dirname_for_local_load, MYF(MY_ALLOW_ZERO_PTR));
1256+
my_free(pass);
1257+
my_free(database);
1258+
my_free(host);
1259+
my_free(user);
1260+
my_free(dirname_for_local_load);
12611261

12621262
delete glob_description_event;
12631263
if (mysql)
@@ -1337,7 +1337,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
13371337
argument= (char*) ""; // Don't require password
13381338
if (argument)
13391339
{
1340-
my_free(pass,MYF(MY_ALLOW_ZERO_PTR));
1340+
my_free(pass);
13411341
char *start=argument;
13421342
pass= my_strdup(argument,MYF(MY_FAE));
13431343
while (*argument) *argument++= 'x'; /* Destroy argument */

0 commit comments

Comments
 (0)