@@ -1210,10 +1210,12 @@ int main(int argc,char *argv[])
1210
1210
charset_index= get_command_index (' C' );
1211
1211
delimiter_index= get_command_index (' d' );
1212
1212
delimiter_str= delimiter;
1213
- default_prompt = my_strdup (getenv (" MYSQL_PS1" ) ?
1213
+ default_prompt = my_strdup (PSI_NOT_INSTRUMENTED,
1214
+ getenv (" MYSQL_PS1" ) ?
1214
1215
getenv (" MYSQL_PS1" ) :
1215
1216
" mysql> " ,MYF (MY_WME));
1216
- current_prompt = my_strdup (default_prompt,MYF (MY_WME));
1217
+ current_prompt = my_strdup (PSI_NOT_INSTRUMENTED,
1218
+ default_prompt,MYF (MY_WME));
1217
1219
prompt_counter=0 ;
1218
1220
1219
1221
outfile[0 ]=0 ; // no (default) outfile
@@ -1288,7 +1290,7 @@ int main(int argc,char *argv[])
1288
1290
}
1289
1291
glob_buffer.realloc (512 );
1290
1292
completion_hash_init (&ht, 128 );
1291
- init_alloc_root (&hash_mem_root, 16384 , 0 );
1293
+ init_alloc_root (PSI_NOT_INSTRUMENTED, &hash_mem_root, 16384 , 0 );
1292
1294
memset (&mysql, 0 , sizeof (mysql));
1293
1295
if (sql_connect (current_host,current_db,current_user,opt_password,
1294
1296
opt_silent))
@@ -1355,10 +1357,12 @@ int main(int argc,char *argv[])
1355
1357
1356
1358
/* read-history from file, default ~/.mysql_history*/
1357
1359
if (getenv (" MYSQL_HISTFILE" ))
1358
- histfile=my_strdup (getenv (" MYSQL_HISTFILE" ),MYF (MY_WME));
1360
+ histfile=my_strdup (PSI_NOT_INSTRUMENTED,
1361
+ getenv (" MYSQL_HISTFILE" ),MYF (MY_WME));
1359
1362
else if (getenv (" HOME" ))
1360
1363
{
1361
- histfile=(char *) my_malloc ((uint ) strlen (getenv (" HOME" ))
1364
+ histfile=(char *) my_malloc (PSI_NOT_INSTRUMENTED,
1365
+ (uint ) strlen (getenv (" HOME" ))
1362
1366
+ (uint ) strlen (" /.mysql_history" )+2 ,
1363
1367
MYF (MY_WME));
1364
1368
if (histfile)
@@ -1382,7 +1386,8 @@ int main(int argc,char *argv[])
1382
1386
if (verbose)
1383
1387
tee_fprintf (stdout, " Reading history-file %s\n " ,histfile);
1384
1388
read_history (histfile);
1385
- if (!(histfile_tmp= (char *) my_malloc ((uint ) strlen (histfile) + 5 ,
1389
+ if (!(histfile_tmp= (char *) my_malloc (PSI_NOT_INSTRUMENTED,
1390
+ (uint ) strlen (histfile) + 5 ,
1386
1391
MYF (MY_WME))))
1387
1392
{
1388
1393
fprintf (stderr, " Couldn't allocate memory for temp histfile!\n " );
@@ -1939,7 +1944,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
1939
1944
}
1940
1945
if (embedded_server_arg_count == MAX_SERVER_ARGS-1 ||
1941
1946
!(embedded_server_args[embedded_server_arg_count++]=
1942
- my_strdup (argument, MYF (MY_FAE))))
1947
+ my_strdup (PSI_NOT_INSTRUMENTED,
1948
+ argument, MYF (MY_FAE))))
1943
1949
{
1944
1950
put_info (" Can't use server argument" , INFO_ERROR);
1945
1951
return 0 ;
@@ -1985,7 +1991,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
1985
1991
{
1986
1992
char *start= argument;
1987
1993
my_free (opt_password);
1988
- opt_password= my_strdup (argument, MYF (MY_FAE));
1994
+ opt_password= my_strdup (PSI_NOT_INSTRUMENTED,
1995
+ argument, MYF (MY_FAE));
1989
1996
while (*argument) *argument++= ' x' ; // Destroy argument
1990
1997
if (*start)
1991
1998
start[1 ]=0 ;
@@ -2041,7 +2048,8 @@ static int get_options(int argc, char **argv)
2041
2048
2042
2049
tmp= (char *) getenv (" MYSQL_HOST" );
2043
2050
if (tmp)
2044
- current_host= my_strdup (tmp, MYF (MY_WME));
2051
+ current_host= my_strdup (PSI_NOT_INSTRUMENTED,
2052
+ tmp, MYF (MY_WME));
2045
2053
2046
2054
pagpoint= getenv (" PAGER" );
2047
2055
if (!((char *) (pagpoint)))
@@ -2082,7 +2090,8 @@ static int get_options(int argc, char **argv)
2082
2090
{
2083
2091
skip_updates= 0 ;
2084
2092
my_free (current_db);
2085
- current_db= my_strdup (*argv, MYF (MY_WME));
2093
+ current_db= my_strdup (PSI_NOT_INSTRUMENTED,
2094
+ *argv, MYF (MY_WME));
2086
2095
}
2087
2096
if (tty_password)
2088
2097
opt_password= get_tty_password (NullS);
@@ -2104,6 +2113,12 @@ static int read_and_execute(bool interactive)
2104
2113
String buffer;
2105
2114
#endif
2106
2115
2116
+ /*
2117
+ line can be allocated by:
2118
+ - batch_readline. Use my_free()
2119
+ - my_win_console_readline. Do not free, see tmpbuf.
2120
+ - readline. Use free()
2121
+ */
2107
2122
char *line= NULL ;
2108
2123
char in_string=0 ;
2109
2124
ulong line_number=0 ;
@@ -2207,7 +2222,7 @@ static int read_and_execute(bool interactive)
2207
2222
free the previous entered line.
2208
2223
*/
2209
2224
if (line)
2210
- my_free (line);
2225
+ free (line);
2211
2226
line= readline (prompt);
2212
2227
2213
2228
if (sigint_received)
@@ -2282,7 +2297,7 @@ static int read_and_execute(bool interactive)
2282
2297
/*
2283
2298
free the last entered line.
2284
2299
*/
2285
- my_free (line);
2300
+ free (line);
2286
2301
#endif
2287
2302
2288
2303
/*
@@ -3213,7 +3228,8 @@ static void get_current_db()
3213
3228
{
3214
3229
MYSQL_ROW row= mysql_fetch_row (res);
3215
3230
if (row && row[0 ])
3216
- current_db= my_strdup (row[0 ], MYF (MY_WME));
3231
+ current_db= my_strdup (PSI_NOT_INSTRUMENTED,
3232
+ row[0 ], MYF (MY_WME));
3217
3233
mysql_free_result (res);
3218
3234
}
3219
3235
}
@@ -4452,12 +4468,14 @@ com_connect(String *buffer, char *line)
4452
4468
if (tmp && *tmp)
4453
4469
{
4454
4470
my_free (current_db);
4455
- current_db= my_strdup (tmp, MYF (MY_WME));
4471
+ current_db= my_strdup (PSI_NOT_INSTRUMENTED,
4472
+ tmp, MYF (MY_WME));
4456
4473
tmp= get_arg (buff, 1 );
4457
4474
if (tmp)
4458
4475
{
4459
4476
my_free (current_host);
4460
- current_host=my_strdup (tmp,MYF (MY_WME));
4477
+ current_host=my_strdup (PSI_NOT_INSTRUMENTED,
4478
+ tmp,MYF (MY_WME));
4461
4479
}
4462
4480
}
4463
4481
else
@@ -4645,7 +4663,8 @@ com_use(String *buffer __attribute__((unused)), char *line)
4645
4663
return put_error (&mysql);
4646
4664
}
4647
4665
my_free (current_db);
4648
- current_db=my_strdup (tmp,MYF (MY_WME));
4666
+ current_db=my_strdup (PSI_NOT_INSTRUMENTED,
4667
+ tmp,MYF (MY_WME));
4649
4668
#ifdef HAVE_READLINE
4650
4669
if (select_db > 1 )
4651
4670
build_completion_hash (opt_rehash, 1 );
@@ -5158,7 +5177,8 @@ server_version_string(MYSQL *con)
5158
5177
/* version, space, comment, \0 */
5159
5178
size_t len= strlen (mysql_get_server_info (con)) + strlen (cur[0 ]) + 2 ;
5160
5179
5161
- if ((server_version= (char *) my_malloc (len, MYF (MY_WME))))
5180
+ if ((server_version= (char *) my_malloc (PSI_NOT_INSTRUMENTED,
5181
+ len, MYF (MY_WME))))
5162
5182
{
5163
5183
char *bufp;
5164
5184
bufp = strmov (server_version, mysql_get_server_info (con));
@@ -5175,7 +5195,8 @@ server_version_string(MYSQL *con)
5175
5195
*/
5176
5196
5177
5197
if (server_version == NULL )
5178
- server_version= my_strdup (mysql_get_server_info (con), MYF (MY_WME));
5198
+ server_version= my_strdup (PSI_NOT_INSTRUMENTED,
5199
+ mysql_get_server_info (con), MYF (MY_WME));
5179
5200
}
5180
5201
5181
5202
return server_version ? server_version : " " ;
@@ -5649,8 +5670,10 @@ static void init_username()
5649
5670
(result=mysql_use_result (&mysql)))
5650
5671
{
5651
5672
MYSQL_ROW cur=mysql_fetch_row (result);
5652
- full_username=my_strdup (cur[0 ],MYF (MY_WME));
5653
- part_username=my_strdup (strtok (cur[0 ]," @" ),MYF (MY_WME));
5673
+ full_username=my_strdup (PSI_NOT_INSTRUMENTED,
5674
+ cur[0 ],MYF (MY_WME));
5675
+ part_username=my_strdup (PSI_NOT_INSTRUMENTED,
5676
+ strtok (cur[0 ]," @" ),MYF (MY_WME));
5654
5677
(void ) mysql_fetch_row (result); // Read eof
5655
5678
}
5656
5679
}
@@ -5689,15 +5712,17 @@ static void get_current_os_user() {
5689
5712
!(user= getenv (" LOGIN" )))
5690
5713
user= " UNKNOWN USER" ;
5691
5714
#endif /* _WIN32 */
5692
- current_os_user= my_strdup (user, MYF (MY_WME));
5715
+ current_os_user= my_strdup (PSI_NOT_INSTRUMENTED,
5716
+ user, MYF (MY_WME));
5693
5717
return ;
5694
5718
}
5695
5719
5696
5720
// Get the current OS sudo user name (only for non-Windows platforms).
5697
5721
static void get_current_os_sudouser () {
5698
5722
#ifndef _WIN32
5699
5723
if (getenv (" SUDO_USER" ))
5700
- current_os_sudouser= my_strdup (getenv (" SUDO_USER" ), MYF (MY_WME));
5724
+ current_os_sudouser= my_strdup (PSI_NOT_INSTRUMENTED,
5725
+ getenv (" SUDO_USER" ), MYF (MY_WME));
5701
5726
#endif /* !_WIN32 */
5702
5727
return ;
5703
5728
}
@@ -5708,7 +5733,8 @@ static int com_prompt(String *buffer __attribute__((unused)),
5708
5733
char *ptr=strchr (line, ' ' );
5709
5734
prompt_counter = 0 ;
5710
5735
my_free (current_prompt);
5711
- current_prompt=my_strdup (ptr ? ptr+1 : default_prompt,MYF (MY_WME));
5736
+ current_prompt=my_strdup (PSI_NOT_INSTRUMENTED,
5737
+ ptr ? ptr+1 : default_prompt,MYF (MY_WME));
5712
5738
if (!ptr)
5713
5739
tee_fprintf (stdout, " Returning to default PROMPT of %s\n " , default_prompt);
5714
5740
else
0 commit comments