mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
libmysql/libmysql.c
keep vio from being freed twice when we are low on memory
mysys/safemalloc.c
changes for --safemalloc-mem-limit
sql/mini_client.cc
keep vio from being freed twice
sql/mysqld.cc
changes for --safemalloc-mem-limit
sql/slave.cc
prevent closing connection twice
sql/sql_string.h
shrink() did not work right when my_realloc() failed
BitKeeper/etc/ignore:
Added .gdb_history to the ignore list
libmysql/libmysql.c:
keep vio from being freed twice when we are low on memory
mysys/safemalloc.c:
changes for --safemalloc-mem-limit
sql/mini_client.cc:
keep vio from being freed twice
sql/mysqld.cc:
changes for --safemalloc-mem-limit
sql/slave.cc:
prevent closing connection twice
sql/sql_string.h:
shrink() did not work right when my_realloc() failed
This commit is contained in:
parent
b0f645e465
commit
3dfc0a825e
7 changed files with 39 additions and 6 deletions
|
|
@ -611,6 +611,7 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
|
|||
if (!net->vio || my_net_init(net, net->vio))
|
||||
{
|
||||
vio_delete(net->vio);
|
||||
net->vio = 0; // safety
|
||||
net->last_errno=CR_OUT_OF_MEMORY;
|
||||
strmov(net->last_error,ER(net->last_errno));
|
||||
goto error;
|
||||
|
|
|
|||
|
|
@ -248,6 +248,10 @@ double log_10[32]; /* 10 potences */
|
|||
I_List<THD> threads,thread_cache;
|
||||
time_t start_time;
|
||||
|
||||
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
||||
extern ulonglong safemalloc_mem_limit;
|
||||
#endif
|
||||
|
||||
pthread_key(MEM_ROOT*,THR_MALLOC);
|
||||
pthread_key(THD*, THR_THD);
|
||||
pthread_key(NET*, THR_NET);
|
||||
|
|
@ -2228,7 +2232,7 @@ enum options {
|
|||
OPT_BINLOG_IGNORE_DB, OPT_WANT_CORE,
|
||||
OPT_SKIP_CONCURRENT_INSERT, OPT_MEMLOCK, OPT_MYISAM_RECOVER,
|
||||
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID, OPT_SKIP_SLAVE_START,
|
||||
OPT_SKIP_INNOBASE
|
||||
OPT_SKIP_INNOBASE,OPT_SAFEMALLOC_MEM_LIMIT
|
||||
};
|
||||
|
||||
static struct option long_options[] = {
|
||||
|
|
@ -2284,6 +2288,10 @@ static struct option long_options[] = {
|
|||
{"master-info-file", required_argument, 0, (int) OPT_MASTER_INFO_FILE},
|
||||
{"myisam-recover", optional_argument, 0, (int) OPT_MYISAM_RECOVER},
|
||||
{"memlock", no_argument, 0, (int) OPT_MEMLOCK},
|
||||
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
||||
{"safemalloc-mem-limit", required_argument, 0, (int)
|
||||
OPT_SAFEMALLOC_MEM_LIMIT},
|
||||
#endif
|
||||
{"new", no_argument, 0, 'n'},
|
||||
{"old-protocol", no_argument, 0, 'o'},
|
||||
#ifdef ONE_THREAD
|
||||
|
|
@ -2797,6 +2805,11 @@ static void get_options(int argc,char **argv)
|
|||
case 'P':
|
||||
mysql_port= (unsigned int) atoi(optarg);
|
||||
break;
|
||||
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
|
||||
case OPT_SAFEMALLOC_MEM_LIMIT:
|
||||
safemalloc_mem_limit = atoi(optarg);
|
||||
break;
|
||||
#endif
|
||||
case OPT_SOCKET:
|
||||
mysql_unix_port= optarg;
|
||||
break;
|
||||
|
|
|
|||
10
sql/slave.cc
10
sql/slave.cc
|
|
@ -273,7 +273,10 @@ int fetch_nx_table(THD* thd, MASTER_INFO* mi)
|
|||
error = 0;
|
||||
err:
|
||||
if(mysql)
|
||||
mc_mysql_close(mysql);
|
||||
{
|
||||
mc_mysql_close(mysql);
|
||||
mysql = 0;
|
||||
}
|
||||
if(nx_errno && thd->net.vio)
|
||||
send_error(&thd->net, nx_errno, "Error in fetch_nx_table");
|
||||
|
||||
|
|
@ -942,7 +945,10 @@ pthread_handler_decl(handle_slave,arg __attribute__((unused)))
|
|||
err:
|
||||
thd->query = thd->db = 0; // extra safety
|
||||
if(mysql)
|
||||
mc_mysql_close(mysql);
|
||||
{
|
||||
mc_mysql_close(mysql);
|
||||
mysql = 0;
|
||||
}
|
||||
thd->proc_info = "waiting for slave mutex on exit";
|
||||
pthread_mutex_lock(&LOCK_slave);
|
||||
slave_running = 0;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public:
|
|||
char *new_ptr;
|
||||
if (!(new_ptr=(char*) my_realloc(Ptr,arg_length,MYF(0))))
|
||||
{
|
||||
(void) my_free(Ptr,MYF(0));
|
||||
Alloced_length = 0;
|
||||
real_alloc(arg_length);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue