1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
code slightly modified with Monty's suggestions


libmysqld/lib_sql.cc:
  copying of pointers replaced with my_strdup()-s
sql/sql_class.cc:
  this code should work anyway now
This commit is contained in:
unknown
2004-01-27 13:46:47 +04:00
parent a5af8f1f80
commit 58e442caf3
2 changed files with 4 additions and 6 deletions

View File

@@ -484,7 +484,7 @@ int check_embedded_connection(MYSQL *mysql)
THD *thd= (THD*)mysql->thd; THD *thd= (THD*)mysql->thd;
thd->host= (char*)my_localhost; thd->host= (char*)my_localhost;
thd->host_or_ip= thd->host; thd->host_or_ip= thd->host;
thd->user= mysql->user; thd->user= my_strdup(mysql->user, MYF(0));
return 0; return 0;
} }
@@ -498,8 +498,8 @@ int check_embedded_connection(MYSQL *mysql)
if (mysql->options.client_ip) if (mysql->options.client_ip)
{ {
thd->host= mysql->options.client_ip; thd->host= my_strdup(mysql->options.client_ip, MYF(0));
thd->ip= thd->host; thd->ip= my_strdup(thd->host, MYF(0));
} }
else else
thd->host= (char*)my_localhost; thd->host= (char*)my_localhost;
@@ -511,7 +511,7 @@ int check_embedded_connection(MYSQL *mysql)
goto err; goto err;
} }
thd->user= mysql->user; thd->user= my_strdup(mysql->user, MYF(0));
if (mysql->passwd && mysql->passwd[0]) if (mysql->passwd && mysql->passwd[0])
{ {
memset(thd->scramble, 55, SCRAMBLE_LENGTH); // dummy scramble memset(thd->scramble, 55, SCRAMBLE_LENGTH); // dummy scramble

View File

@@ -323,13 +323,11 @@ THD::~THD()
#endif #endif
DBUG_PRINT("info", ("freeing host")); DBUG_PRINT("info", ("freeing host"));
#ifndef EMBEDDED_LIBRARY
if (host != my_localhost) // If not pointer to constant if (host != my_localhost) // If not pointer to constant
safeFree(host); safeFree(host);
if (user != delayed_user) if (user != delayed_user)
safeFree(user); safeFree(user);
safeFree(ip); safeFree(ip);
#endif
safeFree(db); safeFree(db);
free_root(&warn_root,MYF(0)); free_root(&warn_root,MYF(0));
free_root(&transaction.mem_root,MYF(0)); free_root(&transaction.mem_root,MYF(0));