summaryrefslogtreecommitdiff
path: root/client/mysqlimport.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-12-12 22:58:24 +0100
committerSergei Golubchik <sergii@pisem.net>2011-12-12 22:58:24 +0100
commit6cc9d0ffa0b6d9d0f19cf9445fad0e0ba11e38f8 (patch)
tree6952bb89985c14f7ad5e362dd350d191cadd0d69 /client/mysqlimport.c
parent37c81d81b3940a21b500aff6aeb70e8b1df0b7e8 (diff)
downloadmariadb-git-6cc9d0ffa0b6d9d0f19cf9445fad0e0ba11e38f8.tar.gz
move safemalloc out of dbug.
remeber a real backtrace for every allocation. make safemalloc to tract C++ new/delete too. collateral fixes to make the test suite pass.
Diffstat (limited to 'client/mysqlimport.c')
-rw-r--r--client/mysqlimport.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 3b9939d7c6d..fabec74052d 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -62,6 +62,8 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static longlong opt_ignore_lines= -1;
#include <sslopt-vars.h>
+static char **argv_to_free;
+
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
#endif
@@ -475,10 +477,18 @@ static void db_disconnect(char *host, MYSQL *mysql)
static void safe_exit(int error, MYSQL *mysql)
{
- if (ignore_errors)
+ if (error && ignore_errors)
return;
if (mysql)
mysql_close(mysql);
+
+#ifdef HAVE_SMEM
+ my_free(shared_memory_base_name);
+#endif
+ free_defaults(argv_to_free);
+ mysql_library_end();
+ my_free(opt_password);
+ my_end(my_end_arg);
exit(error);
}
@@ -597,7 +607,6 @@ error:
int main(int argc, char **argv)
{
int error=0;
- char **argv_to_free;
MY_INIT(argv[0]);
if (load_defaults("my",load_default_groups,&argc,&argv))
@@ -687,11 +696,6 @@ int main(int argc, char **argv)
exitcode= error;
db_disconnect(current_host, mysql);
}
- my_free(opt_password);
-#ifdef HAVE_SMEM
- my_free(shared_memory_base_name);
-#endif
- free_defaults(argv_to_free);
- my_end(my_end_arg);
+ safe_exit(0, 0);
return(exitcode);
}