List:Commits« Previous MessageNext Message »
From:monty Date:July 31 2007 7:43pm
Subject:bk commit into 5.1 tree (monty:1.2559)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of monty. When monty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-07-31 22:43:33+03:00, monty@stripped +16 -0
  Added --debug-check option to all mysql clients to print errors and memory leaks
  --debug-info now is as --debug-check but also prints memory and cpu usage
  Part of bugfix for #30127: mysql --debug-info no longer prints memory usage

  client/client_priv.h@stripped, 2007-07-31 22:43:26+03:00, monty@stripped +2 -2
    Added OPT_DBUG_CHECK

  client/mysql.cc@stripped, 2007-07-31 22:43:26+03:00, monty@stripped +16 -7
    Added --debug-check

  client/mysql_upgrade.c@stripped, 2007-07-31 22:43:26+03:00, monty@stripped +18 -7
    Added --debug-check

  client/mysqladmin.cc@stripped, 2007-07-31 22:43:26+03:00, monty@stripped +17 -6
    Added --debug-check

  client/mysqlbinlog.cc@stripped, 2007-07-31 22:43:26+03:00, monty@stripped +16 -7
    Added --debug-check

  client/mysqlcheck.c@stripped, 2007-07-31 22:43:26+03:00, monty@stripped +15 -6
    Added --debug-check

  client/mysqldump.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +16 -7
    Added --debug-check

  client/mysqlimport.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +14 -6
    Added --debug-check

  client/mysqlshow.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +15 -5
    Added --debug-check

  client/mysqlslap.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +15 -9
    Added --debug-check

  client/mysqltest.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +16 -7
    Added --debug-check

  include/my_sys.h@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +2 -2
    Added extra option to TERMINATE to not print statistics

  mysql-test/mysql-test-run.pl@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +6 -6
    --debug-info -> --debug-check to not print memory usage

  mysys/my_getsystime.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +0 -1
    Removed compiler warning

  mysys/my_init.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +8 -3
    Print not freed memory in my_end() if MY_CHECK_ERROR is given

  mysys/safemalloc.c@stripped, 2007-07-31 22:43:27+03:00, monty@stripped +10 -8
    Added extra option to TERMINATE to not print statistics

diff -Nrup a/client/client_priv.h b/client/client_priv.h
--- a/client/client_priv.h	2007-04-19 05:47:49 +03:00
+++ b/client/client_priv.h	2007-07-31 22:43:26 +03:00
@@ -75,6 +75,6 @@ enum options_client
   OPT_SLAP_POST_QUERY,
   OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
   OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
-  OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG,
-  OPT_MAX_CLIENT_OPTION
+  OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
+  OPT_WRITE_BINLOG, OPT_MAX_CLIENT_OPTION
 };
diff -Nrup a/client/mysql.cc b/client/mysql.cc
--- a/client/mysql.cc	2007-07-30 21:58:28 +03:00
+++ b/client/mysql.cc	2007-07-31 22:43:26 +03:00
@@ -43,7 +43,7 @@
 #include <locale.h>
 #endif
 
-const char *VER= "14.13";
+const char *VER= "14.14";
 
 /* Don't try to make a nice table if the data is too big */
 #define MAX_COLUMN_LENGTH	     1024
@@ -129,7 +129,7 @@ enum enum_info_type { INFO_INFO,INFO_ERR
 typedef enum enum_info_type INFO_TYPE;
 
 static MYSQL mysql;			/* The connection */
-static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
+static my_bool ignore_errors=0,wait_flag=0,quick=0,
                connected=0,opt_raw_data=0,unbuffered=0,output_tables=0,
 	       opt_rehash=1,skip_updates=0,safe_updates=0,one_database=0,
 	       opt_compress=0, using_opt_local_infile=0,
@@ -139,9 +139,11 @@ static my_bool info_flag=0,ignore_errors
 	       default_charset_used= 0, opt_secure_auth= 0,
                default_pager_set= 0, opt_sigint_ignore= 0,
                show_warnings= 0, executing_query= 0, interrupted_query= 0;
+static my_bool debug_info_flag, debug_check_flag;
 static my_bool column_types_flag;
 static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0;
+static uint my_end_arg;
 static char * opt_mysql_unix_port=0;
 static int connect_flag=CLIENT_INTERACTIVE;
 static char *current_host,*current_db,*current_user=0,*opt_password=0,
@@ -541,7 +543,7 @@ sig_handler mysql_end(int sig)
   my_free(current_prompt,MYF(MY_ALLOW_ZERO_PTR));
   mysql_server_end();
   free_defaults(defaults_argv);
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO: 0);
+  my_end(my_end_arg);
   exit(status.exit_status);
 }
 
@@ -611,8 +613,11 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
+   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"database", 'D', "Database to use.", (uchar**) &current_db,
    (uchar**) &current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
@@ -927,7 +932,7 @@ get_one_option(int optid, const struct m
     break;
   case '#':
     DBUG_PUSH(argument ? argument : default_dbug_option);
-    info_flag= 1;
+    debug_info_flag= 1;
     break;
   case 's':
     if (argument == disabled_my_option)
@@ -1021,6 +1026,10 @@ static int get_options(int argc, char **
   }
   if (tty_password)
     opt_password= get_tty_password(NullS);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return(0);
 }
 
@@ -3288,7 +3297,7 @@ sql_real_connect(char *host,char *databa
   }
   connected=1;
 #ifndef EMBEDDED_LIBRARY
-  mysql.reconnect=info_flag ? 1 : 0; // We want to know if this happens
+  mysql.reconnect= debug_info_flag; // We want to know if this happens
 #else
   mysql.reconnect= 1;
 #endif
diff -Nrup a/client/mysql_upgrade.c b/client/mysql_upgrade.c
--- a/client/mysql_upgrade.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysql_upgrade.c	2007-07-31 22:43:26 +03:00
@@ -17,6 +17,8 @@
 #include <sslopt-vars.h>
 #include "../scripts/mysql_fix_privilege_tables_sql.c"
 
+#define VER "1.1"
+
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #endif
@@ -32,7 +34,8 @@
 static char mysql_path[FN_REFLEN];
 static char mysqlcheck_path[FN_REFLEN];
 
-static my_bool opt_force, opt_verbose, info_flag;
+static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag;
+static uint my_end_arg= 0;
 static char *opt_user= (char*)"root";
 
 static DYNAMIC_STRING ds_args;
@@ -71,8 +74,11 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar* *) & default_dbug_option,
    (uchar* *) & default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
+   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", 0,
    0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -140,7 +146,7 @@ static void die(const char *fmt, ...)
   va_end(args);
 
   free_used_memory();
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
   exit(1);
 }
 
@@ -202,8 +208,9 @@ get_one_option(int optid, const struct m
   switch (optid) {
 
   case '?':
-    printf("MySQL utility for upgrading database to MySQL version %s\n",
-           MYSQL_SERVER_VERSION);
+    printf("%s  Ver %s Distrib %s, for %s (%s)\n",
+           my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
+    puts("MySQL utility for upgrading databases to new MySQL versions\n");
     my_print_help(my_long_options);
     exit(0);
     break;
@@ -734,6 +741,10 @@ int main(int argc, char **argv)
 
   if (handle_options(&argc, &argv, my_long_options, get_one_option))
     die(NULL);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (tty_password)
   {
@@ -782,7 +793,7 @@ int main(int argc, char **argv)
   create_mysql_upgrade_info_file();
 
   free_used_memory();
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
   exit(0);
 }
 
diff -Nrup a/client/mysqladmin.cc b/client/mysqladmin.cc
--- a/client/mysqladmin.cc	2007-07-30 21:58:28 +03:00
+++ b/client/mysqladmin.cc	2007-07-31 22:43:26 +03:00
@@ -40,9 +40,10 @@ ulonglong last_values[MAX_MYSQL_VAR];
 static int interval=0;
 static my_bool option_force=0,interrupted=0,new_line=0,
                opt_compress=0, opt_relative=0, opt_verbose=0, opt_vertical=0,
-               tty_password= 0, info_flag= 0, opt_nobeep;
-static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
-            opt_count_iterations= 0;
+               tty_password= 0, opt_nobeep;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
+static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations;
+static uint opt_count_iterations= 0, my_end_arg;
 static ulong opt_connect_timeout, opt_shutdown_timeout;
 static char * unix_port=0;
 #ifdef LATER_HAVE_NDBCLUSTER_DB
@@ -134,10 +135,16 @@ static struct my_option my_long_options[
    "Number of iterations to make. This works with -i (--sleep) only.",
    (uchar**) &nr_iterations, (uchar**) &nr_iterations, 0, GET_UINT,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#ifndef DBUG_OFF
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+#endif
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"force", 'f',
    "Don't ask for confirmation on drop database; with multiple commands, continue even if an error occurs.",
    (uchar**) &option_force, (uchar**) &option_force, 0, GET_BOOL, NO_ARG, 0, 0,
@@ -315,6 +322,10 @@ int main(int argc,char *argv[])
     free_defaults(save_argv);
     exit(ho_error);
   }
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (argc == 0)
   {
@@ -413,7 +424,7 @@ int main(int argc,char *argv[])
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
   free_defaults(save_argv);
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
   exit(error ? 1 : 0);
   return 0;
 }
diff -Nrup a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
--- a/client/mysqlbinlog.cc	2007-07-30 21:58:28 +03:00
+++ b/client/mysqlbinlog.cc	2007-07-31 22:43:26 +03:00
@@ -65,11 +65,13 @@ static bool one_database=0, to_last_remo
 static bool opt_hexdump= 0;
 static bool opt_base64_output= 0;
 static const char* database= 0;
-static my_bool force_opt= 0, short_form= 0, remote_opt= 0, info_flag;
+static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
+static my_bool debug_info_flag, debug_check_flag;
 static my_bool force_if_open_opt= 1;
 static ulonglong offset = 0;
 static const char* host = 0;
 static int port= 0;
+static uint my_end_arg;
 static const char* sock= 0;
 static const char* user = 0;
 static char* pass = 0;
@@ -727,8 +729,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log.", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
     "enabled --to-last-log and are sending the output to the same MySQL server. "
     "This way you could avoid an endless loop. You would also like to use it "
@@ -860,7 +866,7 @@ static void die(const char* fmt, ...)
   va_end(args);
   cleanup();
   /* We cannot free DBUG, it is used in global destructors after exit(). */
-  my_end((info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0) | MY_DONT_FREE_DBUG);
+  my_end(my_end_arg | MY_DONT_FREE_DBUG);
   exit(1);
 }
 
@@ -868,7 +874,7 @@ static void die(const char* fmt, ...)
 
 static void print_version()
 {
-  printf("%s Ver 3.2 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
+  printf("%s Ver 3.3 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE);
   NETWARE_SET_SCREEN_MODE(1);
 }
 
@@ -984,7 +990,10 @@ static int parse_args(int *argc, char***
   load_defaults("my",load_default_groups,argc,argv);
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
-
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return 0;
 }
 
@@ -1597,7 +1606,7 @@ int main(int argc, char** argv)
   my_free_open_file_info();
   load_processor.destroy();
   /* We cannot free DBUG, it is used in global destructors after exit(). */
-  my_end((info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0) | MY_DONT_FREE_DBUG);
+  my_end(my_end_arg | MY_DONT_FREE_DBUG);
 
   if (file_not_closed_error)
   {
diff -Nrup a/client/mysqlcheck.c b/client/mysqlcheck.c
--- a/client/mysqlcheck.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysqlcheck.c	2007-07-31 22:43:26 +03:00
@@ -15,7 +15,7 @@
 
 /* By Jani Tolonen, 2001-04-20, MySQL Development Team */
 
-#define CHECK_VERSION "2.4.5"
+#define CHECK_VERSION "2.5.0"
 
 #include "client_priv.h"
 #include <m_ctype.h>
@@ -33,10 +33,11 @@ static my_bool opt_alldbs = 0, opt_check
                opt_compress = 0, opt_databases = 0, opt_fast = 0,
                opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
                opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
-               tty_password= 0, opt_frm= 0, info_flag= 0, 
+               tty_password= 0, opt_frm= 0, debug_info_flag= 0, debug_check_flag= 0,
                opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
                opt_write_binlog= 1;
 static uint verbose = 0, opt_mysql_port=0;
+static int my_end_arg;
 static char * opt_mysql_unix_port = 0;
 static char *opt_password = 0, *current_user = 0, 
 	    *default_charset = (char *)MYSQL_DEFAULT_CHARSET_NAME,
@@ -96,8 +97,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", (uchar**) &default_charset,
    (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -375,6 +380,10 @@ static int get_options(int *argc, char *
   }
   if (tty_password)
     opt_password = get_tty_password(NullS);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return(0);
 } /* get_options */
 
@@ -762,7 +771,7 @@ int main(int argc, char **argv)
   */
   if (get_options(&argc, &argv))
   {
-    my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+    my_end(my_end_arg);
     exit(EX_USAGE);
   }
   if (dbConnect(current_host, current_user, opt_password))
@@ -804,6 +813,6 @@ int main(int argc, char **argv)
 #ifdef HAVE_SMEM
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
   return(first_error!=0);
 } /* main */
diff -Nrup a/client/mysqldump.c b/client/mysqldump.c
--- a/client/mysqldump.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysqldump.c	2007-07-31 22:43:27 +03:00
@@ -36,7 +36,7 @@
 ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
 */
 
-#define DUMP_VERSION "10.12"
+#define DUMP_VERSION "10.13"
 
 #include <my_global.h>
 #include <my_sys.h>
@@ -100,9 +100,9 @@ static my_bool  verbose= 0, opt_no_creat
                 opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1,
                 opt_events= 0,
                 opt_alltspcs=0, opt_notspcs= 0;
+static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
 static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static MYSQL mysql_connection,*mysql=0;
-static my_bool insert_pat_inited= 0, info_flag;
 static DYNAMIC_STRING insert_pat;
 static char  *opt_password=0,*current_user=0,
              *current_host=0,*path=0,*fields_terminated=0,
@@ -116,7 +116,8 @@ static char compatible_mode_normal_str[2
 static ulong opt_compatible_mode= 0;
 #define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
 #define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
-static uint     opt_mysql_port= 0, opt_master_data;
+static uint opt_mysql_port= 0, opt_master_data;
+static uint my_end_arg;
 static char * opt_mysql_unix_port=0;
 static int   first_error=0;
 static DYNAMIC_STRING extended_row;
@@ -242,8 +243,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
    (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", (uchar**) &default_charset,
    (uchar**) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -724,7 +729,7 @@ get_one_option(int optid, const struct m
     break;
   case '#':
     DBUG_PUSH(argument ? argument : default_dbug_option);
-    info_flag= 1;
+    debug_info_flag= 1;
     break;
 #include <sslopt-case.h>
   case 'V': print_version(); exit(0);
@@ -858,6 +863,10 @@ static int get_options(int *argc, char *
 
   *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;
   *mysql_params->p_net_buffer_length= opt_net_buffer_length;
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (opt_delayed)
     opt_lock=0;                         /* Can't have lock with delayed */
@@ -1262,7 +1271,7 @@ static void free_resources()
     dynstr_free(&insert_pat);
   if (defaults_argv)
     free_defaults(defaults_argv);
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
 }
 
 
diff -Nrup a/client/mysqlimport.c b/client/mysqlimport.c
--- a/client/mysqlimport.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysqlimport.c	2007-07-31 22:43:27 +03:00
@@ -24,7 +24,7 @@
 **			   *			   *
 **			   *************************
 */
-#define IMPORT_VERSION "3.6"
+#define IMPORT_VERSION "3.7"
 
 #include "client_priv.h"
 #include "mysql_version.h"
@@ -49,8 +49,8 @@ static char *add_load_option(char *ptr,c
 static my_bool	verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
 		replace=0,silent=0,ignore=0,opt_compress=0,
                 opt_low_priority= 0, tty_password= 0;
-static my_bool info_flag= 0;
-static uint opt_use_threads=0, opt_local_file=0;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
+static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0;
 static char	*opt_password=0, *current_user=0,
 		*current_host=0, *current_db=0, *fields_terminated=0,
 		*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
@@ -87,8 +87,12 @@ static struct my_option my_long_options[
    0, 0, 0},
   {"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
    GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"delete", 'd', "First delete all rows from table.", (uchar**) &opt_delete,
    (uchar**) &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"fields-terminated-by", OPT_FTB,
@@ -254,6 +258,10 @@ static int get_options(int *argc, char *
 
   if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (enclosed && opt_enclosed)
   {
@@ -659,6 +667,6 @@ int main(int argc, char **argv)
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
   free_defaults(argv_to_free);
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
   return(exitcode);
 }
diff -Nrup a/client/mysqlshow.c b/client/mysqlshow.c
--- a/client/mysqlshow.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysqlshow.c	2007-07-31 22:43:27 +03:00
@@ -15,7 +15,7 @@
 
 /* Show databases, tables or columns */
 
-#define SHOW_VERSION "9.6"
+#define SHOW_VERSION "9.10"
 
 #include "client_priv.h"
 #include <my_sys.h>
@@ -28,7 +28,9 @@
 
 static char * host=0, *opt_password=0, *user=0;
 static my_bool opt_show_keys= 0, opt_compress= 0, opt_count=0, opt_status= 0;
-static my_bool tty_password= 0, opt_table_type= 0, info_flag= 0;
+static my_bool tty_password= 0, opt_table_type= 0;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
+static uint my_end_arg= 0;
 static uint opt_verbose=0;
 static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
 
@@ -150,7 +152,7 @@ int main(int argc, char **argv)
 #ifdef HAVE_SMEM
   my_free(shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR));
 #endif
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
   exit(error ? 1 : 0);
   return 0;				/* No compiler warnings */
 }
@@ -176,8 +178,12 @@ static struct my_option my_long_options[
    0, 0, 0},
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
    0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", (uchar**) &host, (uchar**) &host, 0, GET_STR,
@@ -326,6 +332,10 @@ get_options(int *argc,char ***argv)
     */
     opt_verbose= 2;
   }
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
   return;
 }
 
diff -Nrup a/client/mysqlslap.c b/client/mysqlslap.c
--- a/client/mysqlslap.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysqlslap.c	2007-07-31 22:43:27 +03:00
@@ -69,7 +69,7 @@ TODO:
 
 */
 
-#define SHOW_VERSION "0.9"
+#define SLAP_VERSION "1.0"
 
 #define HUGE_STRING_LENGTH 8196
 #define RAND_STRING_SIZE 126
@@ -128,10 +128,8 @@ const char *delimiter= "\n";
 
 const char *create_schema_string= "mysqlslap";
 
-static my_bool opt_preserve, info_flag;
-
+static my_bool opt_preserve= 0, debug_info_flag= 0, debug_check_flag= 0;
 static my_bool opt_only_print= FALSE;
-
 static my_bool opt_compress= FALSE, tty_password= FALSE,
                opt_silent= FALSE,
                auto_generate_sql_autoincrement= FALSE,
@@ -144,13 +142,14 @@ static unsigned long connect_flags= CLIE
 static int verbose, delimiter_length;
 const char *num_int_cols_opt;
 const char *num_char_cols_opt;
+
 /* Yes, we do set defaults here */
 static unsigned int num_int_cols= 1;
 static unsigned int num_char_cols= 1;
 static unsigned int num_int_cols_index= 0; 
 static unsigned int num_char_cols_index= 0;
-
 static unsigned int iterations;
+static uint my_end_arg= 0;
 static char *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
 static ulonglong actual_queries= 0;
 static ulonglong auto_actual_queries;
@@ -403,7 +402,7 @@ int main(int argc, char **argv)
     my_free(shared_memory_base_name, MYF(MY_ALLOW_ZERO_PTR));
 #endif
   free_defaults(defaults_argv);
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
+  my_end(my_end_arg);
 
   return 0;
 }
@@ -546,8 +545,11 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
     (uchar**) &default_dbug_option, (uchar**) &default_dbug_option, 0, GET_STR,
     OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", 'T', "Print some debug info at exit.", (uchar**) &debug_info_flag,
+   (uchar**) &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"delimiter", 'F',
     "Delimiter to use in SQL statements supplied in file or command line.",
     (uchar**) &delimiter, (uchar**) &delimiter, 0, GET_STR, REQUIRED_ARG,
@@ -638,7 +640,7 @@ static struct my_option my_long_options[
 
 static void print_version(void)
 {
-  printf("%s  Ver %s Distrib %s, for %s (%s)\n",my_progname,SHOW_VERSION,
+  printf("%s  Ver %s Distrib %s, for %s (%s)\n",my_progname, SLAP_VERSION,
          MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
 }
 
@@ -1092,6 +1094,10 @@ get_options(int *argc,char ***argv)
   DBUG_ENTER("get_options");
   if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
     exit(ho_error);
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   if (!user)
     user= (char *)"root";
diff -Nrup a/client/mysqltest.c b/client/mysqltest.c
--- a/client/mysqltest.c	2007-07-30 21:58:28 +03:00
+++ b/client/mysqltest.c	2007-07-31 22:43:27 +03:00
@@ -31,7 +31,7 @@
   Holyfoot
 */
 
-#define MTEST_VERSION "3.2"
+#define MTEST_VERSION "3.3"
 
 #include "client_priv.h"
 #include <mysql_version.h>
@@ -79,7 +79,8 @@ const char *opt_logdir= "";
 const char *opt_include= 0, *opt_charsets_dir;
 static int opt_port= 0;
 static int opt_max_connect_retries;
-static my_bool opt_compress= 0, silent= 0, verbose= 0, info_flag= 0;
+static my_bool opt_compress= 0, silent= 0, verbose= 0;
+static my_bool debug_info_flag= 0, debug_check_flag= 0;
 static my_bool tty_password= 0;
 static my_bool opt_mark_progress= 0;
 static my_bool ps_protocol= 0, ps_protocol_enabled= 0;
@@ -100,6 +101,7 @@ static const char *load_default_groups[]
 static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
 
 static uint start_lineno= 0; /* Start line of current command */
+static uint my_end_arg= 0;
 
 static char delimiter[MAX_DELIMITER_LENGTH]= ";";
 static uint delimiter_length= 1;
@@ -807,12 +809,11 @@ void free_used_memory()
 static void cleanup_and_exit(int exit_code)
 {
   free_used_memory();
-  my_end(info_flag ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
+  my_end(my_end_arg | MY_CHECK_ERROR);
 
   if (!silent)
   {
-    switch (exit_code)
-    {
+    switch (exit_code) {
     case 1:
       printf("not ok\n");
       break;
@@ -4482,8 +4483,12 @@ static struct my_option my_long_options[
   {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
-  {"debug-info", 'd', "Print some debug info at exit.", (uchar**) &info_flag,
-   (uchar**) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
+   (uchar**) &debug_check_flag, (uchar**) &debug_check_flag, 0,
+   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
+   (uchar**) &debug_info_flag, (uchar**) &debug_info_flag,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"host", 'h', "Connect to host.", (uchar**) &opt_host, (uchar**) &opt_host, 0,
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"include", 'i', "Include SQL before each test case.", (uchar**) &opt_include,
@@ -4726,6 +4731,10 @@ int parse_args(int argc, char **argv)
     opt_db= *argv;
   if (tty_password)
     opt_pass= get_tty_password(NullS);          /* purify tested */
+  if (debug_info_flag)
+    my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
+  if (debug_check_flag)
+    my_end_arg= MY_CHECK_ERROR;
 
   return 0;
 }
diff -Nrup a/include/my_sys.h b/include/my_sys.h
--- a/include/my_sys.h	2007-07-30 11:33:41 +03:00
+++ b/include/my_sys.h	2007-07-31 22:43:27 +03:00
@@ -150,7 +150,7 @@ extern ulonglong sf_malloc_mem_limit;
 #else
 #define my_checkmalloc()
 #undef TERMINATE
-#define TERMINATE(A) {}
+#define TERMINATE(A,B) {}
 #define QUICK_SAFEMALLOC
 #define NORMAL_SAFEMALLOC
 extern void *my_malloc(size_t Size,myf MyFlags);
@@ -618,7 +618,7 @@ extern int nt_share_delete(const char *n
 #endif
 
 #ifndef TERMINATE
-extern void TERMINATE(FILE *file);
+extern void TERMINATE(FILE *file, uint flag);
 #endif
 extern void init_glob_errs(void);
 extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
diff -Nrup a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2007-06-29 15:18:18 +03:00
+++ b/mysql-test/mysql-test-run.pl	2007-07-31 22:43:27 +03:00
@@ -1655,7 +1655,7 @@ sub generate_cmdline_mysqldump ($) {
   my($mysqld) = @_;
   return
     mtr_native_path($exe_mysqldump) .
-      " --no-defaults -uroot --debug-info " .
+      " --no-defaults -uroot --debug-check " .
       "--port=$mysqld->{'port'} " .
       "--socket=$mysqld->{'path_sock'} --password=";
 }
@@ -1908,7 +1908,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlcheck=
     mtr_native_path($exe_mysqlcheck) .
-    " --no-defaults --debug-info -uroot " .
+    " --no-defaults --debug-check -uroot " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} --password=";
 
@@ -1960,7 +1960,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlimport=
     mtr_native_path($exe_mysqlimport) .
-    " -uroot --debug-info " .
+    " -uroot --debug-check " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} --password=";
 
@@ -1977,7 +1977,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlshow=
     mtr_native_path($exe_mysqlshow) .
-    " -uroot --debug-info " .
+    " -uroot --debug-check " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} --password=";
 
@@ -1993,7 +1993,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysqlbinlog=
     mtr_native_path($exe_mysqlbinlog) .
-      " --no-defaults --disable-force-if-open --debug-info";
+      " --no-defaults --disable-force-if-open --debug-check";
   if ( !$opt_extern && $mysql_version_id >= 50000 )
   {
     $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
@@ -2011,7 +2011,7 @@ sub environment_setup () {
   # ----------------------------------------------------
   my $cmdline_mysql=
     mtr_native_path($exe_mysql) .
-    " --no-defaults --debug-info --host=localhost  --user=root --password= " .
+    " --no-defaults --debug-check --host=localhost  --user=root --password= " .
     "--port=$master->[0]->{'port'} " .
     "--socket=$master->[0]->{'path_sock'} ".
     "--character-sets-dir=$path_charsetsdir";
diff -Nrup a/mysys/my_getsystime.c b/mysys/my_getsystime.c
--- a/mysys/my_getsystime.c	2007-07-30 23:49:51 +03:00
+++ b/mysys/my_getsystime.c	2007-07-31 22:43:27 +03:00
@@ -32,7 +32,6 @@ ulonglong my_getsystime()
   return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
 #elif defined(__WIN__)
   LARGE_INTEGER t_cnt;
-  struct timeval tv;
   if (query_performance_frequency)
   {
     QueryPerformanceCounter(&t_cnt);
diff -Nrup a/mysys/my_init.c b/mysys/my_init.c
--- a/mysys/my_init.c	2007-07-30 11:33:42 +03:00
+++ b/mysys/my_init.c	2007-07-31 22:43:27 +03:00
@@ -130,8 +130,9 @@ void my_end(int infoflag)
   */
   FILE *info_file= DBUG_FILE;
   my_bool print_info= (info_file != stderr);
-  /* We do not use DBUG_ENTER here, as after cleanup DBUG is no longer
-     operational, so we cannot use DBUG_RETURN.
+  /*
+    We do not use DBUG_ENTER here, as after cleanup DBUG is no longer
+    operational, so we cannot use DBUG_RETURN.
   */
   DBUG_PRINT("info",("Shutting down"));
   if (!info_file)
@@ -185,7 +186,7 @@ Voluntary context switches %ld, Involunt
     fprintf(info_file,"\nRun time: %.1f\n",(double) clock()/CLOCKS_PER_SEC);
 #endif
 #if defined(SAFEMALLOC)
-    TERMINATE(stderr);		/* Give statistic on screen */
+    TERMINATE(stderr, 1);		/* Give statistic on screen */
 #elif defined(__WIN__) && defined(_MSC_VER)
    _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
    _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDERR );
@@ -196,6 +197,10 @@ Voluntary context switches %ld, Involunt
    _CrtCheckMemory();
    _CrtDumpMemoryLeaks();
 #endif
+  }
+  else if (infoflag & MY_CHECK_ERROR)
+  {
+    TERMINATE(stderr, 0);		/* Print memory leaks on screen */
   }
 
   if (!(infoflag & MY_DONT_FREE_DBUG))
diff -Nrup a/mysys/safemalloc.c b/mysys/safemalloc.c
--- a/mysys/safemalloc.c	2007-05-10 12:59:26 +03:00
+++ b/mysys/safemalloc.c	2007-07-31 22:43:27 +03:00
@@ -51,7 +51,7 @@
 				(equivalent to realloc())
 	FREE( pPtr )		Free memory allocated by NEW
 				(equivalent to free())
-	TERMINATE(file)		End system, report errors and stats on file
+	TERMINATE(file,flag)	End system, report errors and stats on file
   I personally use two more functions, but have not included them here:
 	char *STRSAVE( sPtr )	Save a copy of the string in dynamic memory
 	char *RENEW( pPtr, uSize )
@@ -352,12 +352,15 @@ static int check_ptr(const char *where, 
 
 
 /*
-  TERMINATE(FILE *file)
-    Report on all the memory pieces that have not been
-    free'ed as well as the statistics.
+  Report on all the memory pieces that have not been free'ed
+
+  SYNOPSIS
+    TERMINATE()
+    file   Write output to this file
+    flag   If <> 0, also write statistics 
  */
 
-void TERMINATE(FILE *file)
+void TERMINATE(FILE *file, uint flag)
 {
   struct st_irem *irem;
   DBUG_ENTER("TERMINATE");
@@ -373,8 +376,7 @@ void TERMINATE(FILE *file)
   {
     if (file)
     {
-      fprintf(file, "Warning: Not freed memory segments: %u\n",
-	      sf_malloc_count);
+      fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count);
       (void) fflush(file);
     }
     DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
@@ -414,7 +416,7 @@ void TERMINATE(FILE *file)
     }
   }
   /* Report the memory usage statistics */
-  if (file)
+  if (file && flag)
   {
     fprintf(file, "Maximum memory usage: %ld bytes (%ldk)\n",
 	    sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);
Thread
bk commit into 5.1 tree (monty:1.2559)monty31 Jul